<!doctype html>
<div class="lake-content" typography="classic">
<h1 id="Pduo4"><span class="ne-text">星尘代理</span></h1><p id="563e983c1b1e192be8eb9dc45d8e0ede" class="ne-p"><span class="ne-text">StarAgent部署在每台应用服务器,作为系统服务,通过配置拉起并守护业务应用进程,同时用于收集监控各服务器性能,支持Windows/Linux/IoT</span></p><h2 id="ejdW7"><span class="ne-text">功能特点</span></h2><ol class="ne-ol"><li id="f1031c81533db23681a80adbfd1d6ba7"><span class="ne-text" style="color: #722ED1">自身注册为系统服务,随系统自动启动,支持指定服务名</span></li><li id="fdfd5b17648e4c541acb05ee26ac1b5c"><span class="ne-text" style="color: #722ED1">读取配置文件,拉起目标进程。autostart=true</span></li></ol><ol start="3" class="ne-ol"><li id="d1b2993ceaeaeeb40254cb97754bf7c8"><span class="ne-text" style="color: #722ED1">守护目标进程,如有退出,依据策略或退出码决定是否重新拉起。autorestart=true/false/existcodes</span></li><li id="f835c460c12c4b39565ef9a494448b65"><span class="ne-text" style="color: #722ED1">支持单个应用的启动、停止和重启命令,应用名为all时控制所有应用。start app/stop app/restart app</span></li></ol><ol start="5" class="ne-ol"><li id="1c074789cd48aa8fa7d76d578794115e"><span class="ne-text" style="color: #722ED1">代理退出时,不会关闭应用,代理重新启动后,继续守护应用进程。代理需要更新重启时,不应该影响被守护应用</span></li><li id="a242862cd3e66378c5c335648c520dd0"><span class="ne-text" style="color: #722ED1">代理运行过程中,根据配置的变化自动启动和停止应用,无需人工干涉。</span></li></ol><p id="bfd6c715721dbafa930f89bcf532b50e" class="ne-p"><br></p><h1 id="DcnCg"><span class="ne-text">下载星尘代理</span></h1><p id="9b5739b404f46bec32301f7f51542406" class="ne-p"><span class="ne-text">源码:</span><a href="https://github.com/NewLifeX/Stardust" data-href="https://github.com/NewLifeX/Stardust" target="_blank" class="ne-link"><span class="ne-text">https://github.com/NewLifeX/Stardust</span></a></p><p id="2e395021213d7c77bfc958441412e13c" class="ne-p"><span class="ne-text">国内:</span><a href="https://gitee.com/NewLifeX/Stardust" data-href="https://gitee.com/NewLifeX/Stardust" target="_blank" class="ne-link"><span class="ne-text">https://gitee.com/NewLifeX/Stardust</span></a></p><p id="5f75bbe810cecd08065ec3f0d91652d2" class="ne-p"><span class="ne-text">可以下载源码,编译StarAgent并得到net40/net45/netcore3.1/net50/net60多个输出,支持win-x64/linux-x64/linux-arm,根据需要选用。</span></p><p id="99bb8c8c1fd1cbd96d679ad54d2750ee" class="ne-p"><br></p><p id="59ca347187fb23d5940cb1c0cb75c205" class="ne-p"><span class="ne-text">也可以下载编译好的版本:</span></p><p id="9580a3d5c0a75e617a3549980bbc6bdf" class="ne-p"><a href="http://x.newlifex.com/star/staragent45.zip" data-href="http://x.newlifex.com/star/staragent45.zip" target="_blank" class="ne-link"><span class="ne-text">http://x.newlifex.com/star/staragent45.zip</span></a></p><p id="3e067202e2b3a06a7d773946364f830d" class="ne-p"><a href="http://x.newlifex.com/star/staragent31.zip" data-href="http://x.newlifex.com/star/staragent31.zip" target="_blank" class="ne-link"><span class="ne-text">http://x.newlifex.com/star/staragent31.zip</span></a></p><p id="cca07fcad1af8ec3a3999d151e13d74c" class="ne-p"><a href="http://x.newlifex.com/star/staragent50.zip" data-href="http://x.newlifex.com/star/staragent50.zip" target="_blank" class="ne-link"><span class="ne-text">http://x.newlifex.com/star/staragent50.zip</span></a></p><p id="u9d8b79b5" class="ne-p"><a href="http://x.newlifex.com/star/staragent60.zip" data-href="http://x.newlifex.com/star/staragent60.zip" target="_blank" class="ne-link"><span class="ne-text">http://x.newlifex.com/star/staragent60.zip</span></a></p><p id="a9643e011bc7f3d9ad6fcfe048d5907f" class="ne-p"><span class="ne-text">内含windows启动的StarAgent.exe和Linux启动的StarAgent</span></p><p id="a2cbdfa743269e2264919d3d613ea1d7" class="ne-p"><br></p><h1 id="LY717"><span class="ne-text">Windows安装</span></h1><p id="545ccaa6625628a3cd594295579f0288" class="ne-p"><span class="ne-text">(</span><strong><span class="ne-text" style="color: #F5222D">前置条件是安装好.NET运行时,下面使用net5.0</span></strong><span class="ne-text">)</span></p><p id="9078980aeb3882956460343937ec33d5" class="ne-p"><span class="ne-text">下载压缩包</span><a href="http://x.newlifex.com/star/staragent50.zip" data-href="http://x.newlifex.com/star/staragent50.zip" target="_blank" class="ne-link"><span class="ne-text">http://x.newlifex.com/star/staragent50.zip</span></a><span class="ne-text">,并解压缩到独立目录,使用管理员权限(文件上点击右键选以管理员身份运行)启动StarAgent.exe,按下按键2即可把StarAgent安装为Windows服务,此时出现菜单3,用于启动服务。我们先不启动服务,还需要做一个配置。</span></p><p id="f760b108442b19ceed90b6606d509ca6" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605767024449-6d9730a0-bffc-4380-a747-148c7a3d5ef0.png" width="734" id="LGQKd" class="ne-image"></p><p id="2ed808c74026fffc7f6223963f56de0f" class="ne-p"><strong><span class="ne-text" style="color: #E8323C">按键s,使用星尘</span></strong><span class="ne-text">,配置星尘服务端地址</span></p><p id="bc96c45eb26b4c82c9dd3772b167715b" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605767259370-a8b65ac5-4f64-4221-8a26-85f5227b2cbb.png" width="734" id="ao7Tn" class="ne-image"></p><p id="3f9323a53dc738c6968d4915d50f7f2f" class="ne-p"><span class="ne-text">这里我们输入星尘服务端地址:http://star.newlifex.com:6600,(什么都不填直接回车也是这个地址),使用者在这里输入自己部署的星尘服务端StarServer地址,默认是6600端口。</span></p><p id="71e595b68fac1a95800f2fc5b6a20441" class="ne-p"><br></p><p id="5938da51c59e6eea64027b67d8e9c102" class="ne-p"><span class="ne-text">最后按键3,启动服务</span></p><p id="b0d3d7e5db7979ccfa3107729dc0b853" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605767359090-56d33a01-bf9c-4270-af1e-27ef1b9508e5.png" width="385" id="qlH9u" class="ne-image"></p><p id="c944049b2e4884d791abdd65bbf76e09" class="ne-p"><span class="ne-text">启动后按0退出控制台窗口。在该窗口退出之前,StarAgent实际上存在两个进程,一个是上面的控制台窗口,另一个是Windows服务进程。这里只需要退出控制台窗口即可。</span></p><p id="3de2e79bde1d21285f85856a4e2a9fbe" class="ne-p"><br></p><p id="b902bc16face9036f8f682fca2fbc280" class="ne-p"><span class="ne-text">也可以在任务管理器的服务栏启动和停止服务,快速按下st,选择行定位到StarAgent,然后右键控制服务。</span></p><p id="ede65e4f45198a6f2f3a234f6d5b8ad2" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605767485074-6c88101c-ea82-4d6b-bc6a-c740f3847966.png" width="500" id="xGAnN" class="ne-image"></p><p id="9d6f385e4e3452e55e892079b79f4f83" class="ne-p"><br></p><h1 id="0xxuF"><span class="ne-text">Linux安装</span></h1><p id="9c34c83438160531c312a52aae22c01d" class="ne-p"><span class="ne-text">(</span><strong><span class="ne-text" style="color: #F5222D">前置条件是安装好.NET运行时,下面使用net5.0</span></strong><span class="ne-text">)</span></p><p id="4ea0ea30066d6cba7c1277ee4ba6399f" class="ne-p"><span class="ne-text">Linux安装稍微复杂一点,下载压缩包 </span><a href="http://x.newlifex.com/staragent50.zip" data-href="http://x.newlifex.com/staragent50.zip" target="_blank" class="ne-link"><span class="ne-text">http://x.newlifex.com/staragent50.zip</span></a><span class="ne-text">,并解压到独立目录</span></p><pre data-language="bash" id="paBKg" class="ne-codeblock language-bash">wget http://x.newlifex.com/staragent50.zip
mkdir agent
unzip staragent50.zip -d agent
cd agent
chmod +x StarAgent</pre><p id="62f5f1d5821e54c9d4a6a56a7caf33a6" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605768006423-3b3a4bde-925f-4be8-b565-3a9caed44607.png" width="666.5" id="nnp1o" class="ne-image"></p><p id="9cb1c8f7062651d7e5c381b1802b67e7" class="ne-p"><br></p><p id="ed8be39134b01b75bfdaa9b7f8f6ad5b" class="ne-p"><span class="ne-text">此时,可以运行 ./StarAgent 跑起来,按键s,设置星尘服务端地址为 http://star.newlifex.com:6600</span><span class="ne-text">,使用者在这里输入自己部署的星尘服务端StarServer地址,默认是6600端口。</span></p><p id="20021e2dfcccf666d52c5929d88e44f6" class="ne-p"><span class="ne-text">设置完成后按0退出。</span></p><p id="08862d0ab71b5eec52e51dbbdeec1377" class="ne-p"><br></p><p id="777e198da925cfa2e1b595088554188c" class="ne-p"><span class="ne-text">此时,StarAgent的启动有两种方式:</span></p><p id="326ac47df1374e705fb0646385cd43e2" class="ne-p"><span class="ne-text">1,直接nohup启动</span></p><pre data-language="bash" id="FK2Pt" class="ne-codeblock language-bash">nohup ./StarAgent -run &</pre><p id="0aa8e845ecfc8a27c3fbd8d609906f90" class="ne-p"><span class="ne-text">带上-run参数,直接以当前用户身份启动。</span></p><p id="8b0d93a66c39cb5300f04cd291ff97d9" class="ne-p"><span class="ne-text">该方案简单易用,唯一缺点就是,服务器重启后,StarAgent不会自动启动。</span></p><p id="71b47ab8d86868e9aa1bc07a1512bb70" class="ne-p"><br></p><p id="27f538e9dec9fdce15f59896298f0346" class="ne-p"><span class="ne-text">2,安装为systemd守护进程</span></p><pre data-language="bash" id="AiJmw" class="ne-codeblock language-bash">sudo ./StarAgent -i && sudo ./StarAgent -start</pre><p id="2e30949b75014d05c8814301e089651c" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605772133885-dbee8eec-f973-40a4-8ff5-eb4d3ad38a82.png" width="864.5" id="mZuW5" class="ne-image"></p><p id="007f3eded54691f54b2c2508f795ba18" class="ne-p"><br></p><p id="07abc6e1d5bf6082da66a518940edd36" class="ne-p"><span class="ne-text">也可以像Windows那样,启动StarAgent后通过按键菜单来操作安装。</span></p><p id="a19376fb68c0a093f6325273f280d057" class="ne-p"><br></p><p id="15ef6bc6562c28cd7163bac9248d6293" class="ne-p"><span class="ne-text">特别注意,必须要sudo权限才能安装为守护进程,否则报错</span></p><p id="98af4a8da6973752cd106753a778cf30" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605771619435-b7b901f4-598e-4d72-bea9-5618c007b125.png" width="872.5" id="thrRl" class="ne-image"></p><p id="886a472357421a1cb5a8fb289b120e7e" class="ne-p"><br></p><h1 id="osWEJ"><span class="ne-text">节点管理</span></h1><p id="53fa8ef2910f8ecb7dc560f285dfaaed" class="ne-p"><span class="ne-text">所有安装了StarAgent的服务器或桌面电脑,或IOT设备,统称星尘节点,定时(默认60s)向星尘服务端StarServer上报硬件信息和资源状态信息。</span></p><p id="c853a5f4a49fdb2a0d8bff320a5cc1f4" class="ne-p"><span class="ne-text">打开星尘控制台 http://star.newlifex.com 查看节点管理,即可看到。</span></p><p id="1737a4a643a7e32bcf552957815d1b7e" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605772220818-d2bb0723-26c7-4c51-95e9-e45b90a0e0d4.png" width="849.5" id="Yur0j" class="ne-image"></p><p id="02586f0275944d40472c7cad21c1feca" class="ne-p"><br></p><p id="f14781152440f2d06908964aa60aeb64" class="ne-p"><span class="ne-text">点击数据链接,还可以查看该节点最近24小时的资源状态数据。</span></p><p id="79d38a40dd3ab1f8f4cb17cb05c5929a" class="ne-p"><img src="https://cdn.nlark.com/yuque/0/2020/png/1144030/1605772387396-113a7cc4-3949-4952-aa8c-b6dd84d43443.png" width="1109.5" id="jQPMg" class="ne-image"></p><p id="6062eb07db654c209d82ef0e77c4979b" class="ne-p"><br></p><p id="23c3a32fab8e29dbc83f675911bcd9dc" class="ne-p"><br></p>
</div>
|