在Linux上部署Java项目过程

文章目录

1、ps -ef | grep java

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
root      192107       1  1 May22 ?        20:38:41 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root      220703       1  0 May22 ?        05:11:06 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
root      252545       1  0 May22 ?        03:31:45 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
root     1401323       1  0 Jul11 ?        00:07:10 java -jar bailian-service-main-1.0.0-SNAPSHOT.jar
root     2692454 2542595  0 16:04 pts/0    00:00:00 grep --color=auto java

2、杀死指定的.jar程序

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# kill 1401323
[root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
root      192107       1  1 May22 ?        20:38:44 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root      220703       1  0 May22 ?        05:11:07 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
root      252545       1  0 May22 ?        03:31:46 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
root     2698202 2542595  0 16:07 pts/0    00:00:00 grep --color=auto java

3、此时再查看java进程

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
root      192107       1  1 May22 ?        20:39:00 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
root      220703       1  0 May22 ?        05:11:13 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
root      252545       1  0 May22 ?        03:31:50 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
root     2744062 2542595  0 16:31 pts/0    00:00:00 grep --color=auto java

4、找到.jar包在linux上存储的位置

bash 复制代码
[root@iZuf6332h890vozldoxcprZ ~]# find / -name *.jar
/bailian/bailian-service-base-1.0.0-SNAPSHOT.jar
/bailian/bailian-service-app-1.0.0-SNAPSHOT.jar
/bailian/bak/bailian-service-main-1.0.0-SNAPSHOT.jar
/bailian/bailian-service-main-1.0.0-SNAPSHOT.jar

5、切换到存放.jar目录

bash 复制代码
[root@iZuf6332h890vozldoxcprZ ~]# cd /bailian/
[root@iZuf6332h890vozldoxcprZ bailian]# ll
total 1626640
-rw-r--r-- 1 root root      29471 May 20 15:50 333.txt
-rw-r--r-- 1 root root  111911562 Aug 24  2023 bailian-service-app-1.0.0-SNAPSHOT.jar
-rw-r--r-- 1 root root  108757893 Aug 15  2023 bailian-service-base-1.0.0-SNAPSHOT.jar
-rw-r--r-- 1 root root  117371177 Jul 11 15:24 bailian-service-main-1.0.0-SNAPSHOT.jar
drwxr-xr-x 2 root root        104 Jul 11 15:23 bak
drwxr-xr-x 3 root root         18 Aug 14  2023 bat
drwxr-xr-x 7 root root         96 Aug  9  2022 nacos
-rw------- 1 root root 1327590305 Jul 12 16:07 nohup.out
drwxr-xr-x 3 root root        114 May 22  2023 template

5、把相应的.jar包放入这个目录

6、启动指定的java程序

bash 复制代码
[root@iZuf6332h890vozldoxcprZ bailian]# nohup java -jar bailian-service-main-1.0.0-SNAPSHOT.jar &
[1] 2749319
[root@iZuf6332h890vozldoxcprZ bailian]# nohup: ignoring input and appending output to 'nohup.out'
相关推荐
布鲁格若门3 分钟前
CentOS 7 桌面版安装 cuda 12.4
linux·运维·centos·cuda
Eternal-Student8 分钟前
【docker 保存】将Docker镜像保存为一个离线的tar归档文件
运维·docker·容器
不是二师兄的八戒10 分钟前
本地 PHP 和 Java 开发环境 Docker 化与配置开机自启
java·docker·php
C-cat.11 分钟前
Linux|进程程序替换
linux·服务器·microsoft
怀澈12212 分钟前
高性能服务器模型之Reactor(单线程版本)
linux·服务器·网络·c++
DC_BLOG15 分钟前
Linux-Apache静态资源
linux·运维·apache
学Linux的语莫16 分钟前
Ansible Playbook剧本用法
linux·服务器·云计算·ansible
码农小丘17 分钟前
一篇保姆式centos/ubuntu安装docker
运维·docker·容器
爱编程的小生22 分钟前
Easyexcel(2-文件读取)
java·excel
带多刺的玫瑰39 分钟前
Leecode刷题C语言之统计不是特殊数字的数字数量
java·c语言·算法