下載seata:??https://github.com/seata/seata/releases
解壓 tar -xvf seata.tar.gz
修改registry.conf文件
修改file.conf
啟動(dòng):
nohup ./seata-server.sh -p 8091 -m file >/app/data/logs/seata/seata_nohup.log 2>&1 &
nohup sh seata-server.sh -p 8091 -h 127.0.0.1 -m file > seata.log &
nohup? sh seata-server.sh -p 8091 -h 127.0.0.1 -m file > ../logs/seata_start.log 2>&1 &
-p 指定啟動(dòng)seata server的端口號(hào)千诬。
-h 指定seata server所綁定的主機(jī)雕擂。
-m 事務(wù)日志赋秀、事務(wù)執(zhí)行信息存儲(chǔ)的方式哼御,目前支持file(文件方式)逗余、db(數(shù)據(jù)庫(kù)方式说榆,建表語(yǔ)句請(qǐng)查看config/db_store.sql页滚、config/db_undo_log.sql)
設(shè)置開(kāi)機(jī)啟動(dòng):
創(chuàng)建服務(wù)文件:
vi /etc/init.d/seata
內(nèi)容如下:
#!/bin/bash
#
#chkconfig: 345 63 37
#description: seata
#processname: seata
#export NODE_HOME=/usr/local/node-v15.5.0-linux-x64
export JAVA_HOME=/app/jdk1.8.0_191
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#export NODE_PATH=$NODE_HOME/lib/node_modules
#export PATH=$PWD/bin:/usr/local/openresty/nginx/sbin:$JAVA_HOME/bin:$NODE_HOME/bin:$PATH
SEATA_HOME=/app/seata
case $1 in
? start)
? ? nohup sh $SEATA_HOME/bin/seata-server.sh -p 8091 -h 192.168.0.126 -m db > $SEATA_HOME/logs/seata-start.log 2>&1 &
? ? ? ? echo $! > $SEATA_HOME/bin/seata.pid
? ? echo "seata is started"
? ? ;;
? stop)
? ? pid=`cat $SEATA_HOME/bin/seata.pid`
? ? kill -9 $pid
? ? echo "seata is stopped"
? ? ;;
? restart)
? ? pid=`cat $SEATA_HOME/bin/seata.pid`
? ? kill -9 $pid
? ? echo "seata is stopped"
? ? sleep 1
? ? nohup sh $SEATA_HOME/bin/seata-server.sh -p 8091 -h 192.168.0.126 -m db > $SEATA_HOME/logs/seata-start.log 2>&1 &
? ? ? ? echo $! > $SEATA_HOME/bin/seata.pid
? ? echo "seata is started"
? ? ;;
? *)
? ? echo "start|stop|restart"
? ? ;;
esac
exit 0
測(cè)試:service seata start
查看是否啟動(dòng)成功:
加入開(kāi)機(jī)啟動(dòng):
chkconfig --add seata
查看加入開(kāi)機(jī)啟動(dòng)是否成功
chkconfig --list