linux 安装seata

1.安装

[root@ls_t3rdypvp local]# tar -zxvf seata-server-1.4.2.tar.gz

从官网下载相关的配置文件,我这里是用nacos做注册中心和配置中心
https://github.com/seata/seata/tree/develop/script
先将nacos-config.sh 转换为unix格式,用nodepad打开该文件
将config.txt 上传到/usr/local/seata 目录,把nacos-config.py 和 nacos-config.sh 上传到/usr/local/seata/config 目录
在这里插入图片描述

[root@ls_t3rdypvp seata]# ll
total 40
drwxr-xr-x 2 root root   4096 Sep  2 10:50 bin
drwxr-xr-x 4  502 games  4096 Sep  2 10:50 conf
-rw-r--r-- 1 root root   3548 Sep  2 11:14 config.txt
drwxr-xr-x 3  502 games 12288 Sep  2 10:50 lib
-rw-r--r-- 1  502 games 11365 May 13  2019 LICENSE
drwxr-xr-x 2  502 games  4096 Apr 25 16:01 logs

2.修改配置文件

修改registry.conf ,将 注册中心和配置中心换为nacos

[root@ls_t3rdypvp conf]# vim registry.conf

registry {
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  type = "nacos"

  nacos {
    application = "seata-server"
    serverAddr = "本机ip:8848"
    group = "SEATA_GROUP"
    namespace = ""
    cluster = "default"
    username = "nacos"
    password = "nacos"
  }
  eureka {
    serviceUrl = "http://localhost:8761/eureka"
    application = "default"
    weight = "1"
  }
  redis {
    serverAddr = "localhost:6379"
    db = 0
    password = ""
    cluster = "default"
    timeout = 0
  }
  zk {
    cluster = "default"
    serverAddr = "127.0.0.1:2181"
    sessionTimeout = 6000
    connectTimeout = 2000
    username = ""
    password = ""
  }
  consul {
    cluster = "default"
    serverAddr = "127.0.0.1:8500"
    aclToken = ""
  }
  etcd3 {
    cluster = "default"
    serverAddr = "http://localhost:2379"
  }
  sofa {
    serverAddr = "127.0.0.1:9603"
    application = "default"
    region = "DEFAULT_ZONE"
    datacenter = "DefaultDataCenter"
    cluster = "default"
    group = "SEATA_GROUP"
    addressWaitTime = "3000"
  }
  file {
    name = "file.conf"
  }
}

config {
  # file、nacos 、apollo、zk、consul、etcd3
  type = "nacos"

  nacos {
    serverAddr = "本机ip:8848"
    namespace = ""
    group = "SEATA_GROUP"
    username = "nacos"
    password = "nacos"
    dataId = "seataServer.properties"
  }
  consul {
    serverAddr = "127.0.0.1:8500"
    aclToken = ""
  }
  apollo {
    appId = "seata-server"
    ## apolloConfigService will cover apolloMeta
    apolloMeta = "http://192.168.1.204:8801"
    apolloConfigService = "http://192.168.1.204:8080"
    namespace = "application"
    apolloAccesskeySecret = ""
    cluster = "seata"
  }
  zk {
    serverAddr = "127.0.0.1:2181"
    sessionTimeout = 6000
    connectTimeout = 2000
    username = ""
    password = ""
    nodePath = "/seata/seata.properties"
  }
  etcd3 {
    serverAddr = "http://localhost:2379"
  }
  file {
    name = "file.conf"
  }
}

3.启动

初始化nacos 的配置,启动

[root@ls_t3rdypvp conf]# sh nacos-config.sh 本机Ip
[root@ls_t3rdypvp bin]# sh seata-server.sh -p 8091

在这里插入图片描述

4. systemd 管理seata

编辑seata-server.sh文件,在文件末尾添加2行指令

[root@ls_T3RDyPvP bin]# vim seata-server.sh
#!/bin/bash
sh /usr/local/seata/bin/seata-server.sh -p 8091

创建service

vim /lib/systemd/system/seata-server.service
[Unit]
Description=seata-server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
ExecStart=/usr/local/seata/bin/seata-server.sh
Restart=always
PrivateTmp=true

[Install]
WantedBy=multi-user.target

启动服务

systemctl enable seata-server.service
systemctl daemon-reload
systemctl start seata-server.service
systemctl status seata-server.service

其他指令

systemctl stop seata-server.service
systemctl restart seata-server.service
systemctl reset-failed seata-server.service
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值