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.....