seata 启动交于nacos热处理 配置参数;
使用教程无法导入插件..
nacos版本 1.2.0 ,启动无问题,其他配置项均可修改编辑保存;
seata版本 0.7.1,数据库及初始化都完成,
使用seata-server-0.7.1中conf目录下的python脚本导入nocos时,导入正常,提示启动seata..
但是启动的时候,异常
很明显,没有store.db.url的配置项,到nocus中去查找,发现也是,其他的配置项,均存在,只有该项没有,查看py脚本,发现py读取的文件脚本是nacos-config.txt,查找该txt文件,发现
确实是py读取文件的时候,没有读取到该url..但是问题出在哪里了呢....
import http.client
import sys
if len(sys.argv) != 2:
print ('python nacos-config.py nacosIp')
exit()
headers = {
'content-type': "application/x-www-form-urlencoded"
}
hasError = False
for line in open('nacos-config.txt'):
pair = line.split('=')
if len(pair) != 2:
continue
print (line),
url_prefix = sys.argv[1] + ':8848'
conn = http.client.HTTPConnection(url_prefix)
url_postfix = '/nacos/v1/cs/configs?dataId={}&group=SEATA_GROUP&content={}'.format(str(pair[0]),str(pair[1])).strip()
conn.request("POST", url_postfix, headers=headers)
res = conn.getresponse()
data = res.read()
if data.decode("utf-8") != "true":
hasError = True
if hasError:
print ("init nacos config fail.")
else:
print ("init nacos config finished, please start seata-server.")
稍微能读懂点儿的就会发现了...
而我们的db.url = jdbc.....=true,所以split "="时,此时是3了...所以continue了....好尴尬...
找到问题就好解决了...
1,把nacos-config.txt文件中,=true删掉,或者改成其他的..重新执行py文件,然后再nacus中修改该配置项...
2,或者修改py文件,修改这个continue的地方,
显然还是第一个方便....(当然py爱好者还是喜欢该py的这个bug...哈哈)
相信seata在后续版本中肯定修复了这个bug.....