1.用xftp、WinSCP(我使用的)等文件傳輸工具將jar包上傳到服務器;
示例:我將data-collection-jar-with-dependencies.jar的jar包上傳到服務器的/home/hdfs/data-collection目錄下
2.用xshell連接服務器,在服務器上運行jar包。
示例:cd /home/hdfs/data-collection
(java -jar data-collection-jar-with-dependencies.jar &)
其他相關命令
獲取正在運行jar包進程的pid
示例:ps aux|grep data-collection-jar-with-dependencies.jar
殺死進程編號為pid的進程
示例:kill -9 pid
輸出日志的最后2000行
tail -2000 日志目錄
示例:tail -2000 /home/hdfs/data-collection/logs/log4j.log