1. 程式人生 > 其它 >通俗易懂講 CompletableFuture

通俗易懂講 CompletableFuture

1、先安java

先下載jdk1.8.tar包安裝

tar -zxvf jdk1.8.tar.gz -C /usr/local/java

vi /etc/profile

source /etc/profile

測試jdk安裝情況

執行java、javac、java -version



2、安裝tomcat

tar -zxvf apache-tomcat-9.0.54.tar.gz -C /usr/local/tomcat

vi /etc/profile

新增入CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.54

source /etc/profile

cd /usr/local/tomcat/apache-tomcat-9.0.54

、啟動tomcat

./startup.sh

3、tomcat 註冊為 systemctl

1、catalina.sh檔案,在catlinabase行下新增pid配置。

2、tomcat.service放在/usr/lib/systemd/system下。

------catalina.sh內容新增CATALINA_PID="$CATALINA_BASE/tomcat.pid"(注意上下位置):

Copy CATALINA_BASE from CATALINA_HOME if not already set

[ -z "\(CATALINA_BASE" ] && CATALINA_BASE="\)

CATALINA_HOME"

只新增下面這句,上下為catalina.sh已有的,用來確定位置

CATALINA_PID="$CATALINA_BASE/tomcat9.pid"

Ensure that any user defined CLASSPATH variables are not used on startup,
but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=

-------tomcat.service檔案示例:

[Unit]
Description=tomcat9
After=syslog.target
[Service]
Type=forking

Environment="JAVA_HOME=/usr/local/tools/jdk1.8.0_161"

ExecStart=/opt/apache-tomcat-9.0.26/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
User=root
Group=root
[Install]
WantedBy=multi-user.target

-------tomcat.service檔案配置注意
After為在哪個服務後面啟動。如果需要mysql資料庫,tomcat可配置在mysql後啟動(After=mariadb.service)。
Environment="JAVA_HOME=/usr/local/tools/jdk1.8.0_161"必須配置,etc/profile中的配置在此處不起作用。
ExecStart為啟動地址。

-------systemctl命令

--修改service檔案後,需重新整理

systemctl daemon-reload

--關閉和開啟

systemctl stop tomcat.service

systemctl start tomcat.service

--是否開機自啟

systemctl disable tomcat.service

systemctl enable tomcat.service

4、釋出jenkins

jenkins.war包上傳到tomcat 下 的webapps 目錄 ,tomcat 9會自動釋出jenkins tomcat9 具有熱釋出功能

學之如大海汪洋,薄積厚發,後發制人,大學之道也。