資源簡介
因在github下載seat太慢,上傳tar包資源,供大家學(xué)習(xí)分布式事務(wù),項目版本是0.9.0,用于ubuntu的安裝使用,有問題可以私信?。。?
代碼片段和文件信息
#!/usr/bin/env?python3
#??-*-?coding:?UTF-8?-*-
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(line[line.index(‘=‘)+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.“)
評論
共有 條評論