转载:https://mp.weixin.qq.com/s/yGhgIl_oifPm42SIatT-PA
【Seata官网:http://seata.io/zh-cn/index.html 】
链接: http://seata.io/zh-cn/blog/download.html下载压缩包,解压至非中文目录。
下载版本参考官方,选择适合自己环境的版本。
本文下载seata-server-1.5.2
解压后可以发现原来的conf/registry.conf配置文件没有了,可直接修改application.yml进行配置。
server:
port: 7091
spring:
application:
name: seata-server
# 日志配置
logging:
config: classpath:logback-spring.xml
file:
path: ${user.home}/logs/seata
# 不外接日志,故如下配置可暂不考虑
extend:
logstash-appender:
destination: 127.0.0.1:4560
kafka-appender:
bootstrap-servers: 127.0.0.1:9092
topic: logback_to_logstash
# 新增加的console控制台,
# 可通过访问http://localhost:7091进行登录,账号如下seata/seata
console:
user:
username: seata
password: seata
seata:
# Seata接入Nacos配置中心
config:
# support: file, nacos, consul, apollo, zk, etcd3
type: nacos
nacos:
server-addr: 127.0.0.1:8848
namespace: dev
group: SEATA_GROUP
username: nacos
password: nacos
##if use MSE Nacos with auth, mutex with username/password attribute
#access-key: ""
#secret-key: ""
# Seata接入Nacos服务注册中心
registry:
# support: file, nacos, eureka, redis, zk, consul, etcd3, sofa
type: nacos
nacos:
application: seata-server
server-addr: 127.0.0.1:8848
group: SEATA_GROUP
namespace: dev
cluster: default
username: nacos
password: nacos
##if use MSE Nacos with auth, mutex with username/password attribute
#access-key: ""
#secret-key: ""
# 此处可不必配置,由于接入了nacos配置,以下store相关配置可直接通过seataServer.properties进行配置
# store:
# support: file 、 db 、 redis
# mode: db
# server:
# service-port: 8091 #If not configured, the default is '${server.port} + 1000'
security:
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
tokenValidityInMilliseconds: 1800000
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login
moon@moondeiMac nacos % cd distribution/target/nacos-server-$version/nacos/bin
moon@moondeiMac bin % sh startup.sh -m standalone
# 存储模式
store.mode=db
store.db.datasource=druid
store.db.dbType=mysql
# 需要根据mysql的版本调整driverClassName
# mysql8及以上版本对应的driver:com.mysql.cj.jdbc.Driver
# mysql8以下版本的driver:com.mysql.jdbc.Driver
store.db.driverClassName=com.mysql.jdbc.Driver
# 注意根据生产实际情况调整参数host和port
store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
# 数据库用户名密码
store.db.user=root
store.db.password=12345678
# 微服务里配置与这里一致
service.vgroupMapping.dev_tx_group=default
# 运行指令 ,通过 Git Bash Here
sh nacos-config.sh -h localhost -p 8848 -g SEATA_GROUP -t 29c70061-6c4a-4af7-aca3-2ffcaa086fb5
# 具体说明参见:http://seata.io/zh-cn/docs/user/configurations.html
# -h: nacos host,默认localhost
# -p: nacos端口,默认8848
# -g: nacos分组,默认'SEATA_GROUP'.
# -t: 租户信息Tenant information,对应nacos namespace ID,默认''
# -u: nacos用户名,默认''
# -w: nacos用户密码,默认''
namespace: dev
group: SEATA_GROUP
配置项变成了N个,每项都可单独修改。
sh seata-server.sh