七、新tars服務,框架基礎服務打包
2、新版本與舊版本相比,這裡就是編譯的路徑變了
舊版本是在 ...../Tars-master/cpp/build
新版本是在....../Tars/framework/build
3、解壓之後的framework.tgz檔案,各核心服務的配置檔名也做了修改,但是裡面的內容未變,配置檔案中要改的內容依舊是那些
修改各檔案的配置資訊 ///////////////// sed -i "s/172.18.165.2/g" `grep 192.168.2.131 -rl ./*` sed -i "s/172.18.165.2/g" `grep db.tars.com -rl ./*` sed -i "s/172.18.165.2/g" `grep registry.tars.com -rl ./*` sed -i "s/172.18.165.2/g" `grep web.tars.com -rl ./*`
同樣要修改配置檔案中的資料庫資訊。
4、若通過命令方式無法改動內容,則可以手動修改,修改內容如下
tars.tarsAdminRegistry.config.conf 紅色部分就是要修改的地方
<tars>
<application>
enableset=n
setdivision=NULL
<server>
app=tars
server=tarsAdminRegistry
localip=192.168.2.131
basepath=/usr/local/app/tars/bin
datapath=/usr/local/app/tars/tarsnode/data/tars.tarsAdminRegistry/data
logpath=/usr/local/app/tars/app_log
logsize=10M
config=tars.tarsconfig.ConfigObj
notify=tars.tarsnotify.NotifyObj
deactivating-timeout=2000
logLevel=DEBUG
<tars.tarsAdminRegistry.AdminRegObjAdapter>
allow
endpoint=tcp -h registry.tars.com
handlegroup=tars.tarsAdminRegistry.AdminRegObjAdapter
maxconns=1024
protocol=tars
queuecap=10000
queuetimeout=60000
servant=tars.tarsAdminRegistry.AdminRegObj
threads=5
</tars.tarsAdminRegistry.AdminRegObjAdapter>
</server>
<client>
[email protected] -h registry.tars.com -p 17890
sync-invoke-timeout=3000
async-invoke-timeout=5000
refresh-endpoint-interval=60000
report-interval=60000
sample-rate=100000
max-sample-count=50
asyncthread=3
modulename=tars.tarsAdminRegistry
</client>
</application>
<objname>
AdminRegObjName=tars.tarsAdminRegistry.AdminRegObj
patchServerObj=tars.tarspatch.PatchObj
</objname>
<db>
dbhost=db.tars.com
dbname=db_tars
dbuser=tars
dbpass=tars2015
dbport=3306
charset=utf8
dbflag=CLIENT_MULTI_STATEMENTS
</db>
<nodeinfo>
defaultTemplate=tars.tarsnode
sync_node_timeout=4000
</nodeinfo>
<reap>
updateHeartInterval=15
registryTimeout=150
</reap>
</tars>
5、tars.tarsconfig.config.conf 紅色部分就是要修改的地方
<tars>
<application>
enableset=n
setdivision=NULL
<server>
[email protected] -h 192.168.2.131 -p 19386 -t 60000
app=tars
server=tarsconfig
localip=192.168.2.131
local=tcp -h 127.0.0.1 -p 10001 -t 3000
basepath=/usr/local/app/tars/bin
datapath=/usr/local/app/tars/tarsconfig/data
logpath=/usr/local/app/tars/app_log
logsize=100000000
config=tars.tarsconfig.ConfigObj
notify=tars.tarsnotify.NotifyObj
deactivating-timeout=3000
logLevel=DEBUG
<tars.tarsconfig.ConfigObjAdapter>
allow
endpoint=tcp -h 192.168.2.131 -p 10001 -t 60000
handlegroup=tars.tarsconfig.ConfigObjAdapter
maxconns=10240
protocol=tars
queuecap=10000
queuetimeout=60000
servant=tars.tarsconfig.ConfigObj
shmcap=0
shmkey=0
threads=10
</tars.tarsconfig.ConfigObjAdapter>
</server>
<client>
[email protected] -h registry.tars.com -p 17890
sync-invoke-timeout=3000
async-invoke-timeout=5000
refresh-endpoint-interval=60000
report-interval=60000
sample-rate=100000
max-sample-count=50
asyncthread=3
stat=tars.tarsstat.StatObj
property=tars.tarsproperty.PropertyObj
modulename=tars.tarsconfig
</client>
</application>
<db>
charset=utf8
dbhost=db.tars.com
dbname=db_tars
dbpass=tars2015
dbport=3306
dbuser=tars
</db>
</tars>
6、tars.tarsnode.config.conf 紅色部分就是要修改的地方
<tars>
<application>
enableset=n
setdivision=NULL
<client>
async-invoke-timeout=5000
refresh-endpoint-interval=60000
report-interval=60000
sample-rate=100000
max-sample-count=50
stat=tars.tarsstat.StatObj
property=tars.tarsproperty.PropertyObj
modulename=tars.tarsnode
[email protected] -h registry.tars.com -p 17890
sync-invoke-timeout=6000
asyncthread=3
</client>
<server>
logsize=10M
config=tars.tarsconfig.ConfigObj
notify=tars.tarsnotify.NotifyObj
deactivating-timeout=3000
app=tars
server=tarsnode
localip=192.168.2.131
local=tcp -h 127.0.0.1 -p 19385 -t 10000
basepath=/usr/local/app/tars/tarsnode/data
datapath=/usr/local/app/tars/tarsnode/data
logpath=/usr/local/app/tars/app_log
logLevel=DEBUG
<NodeAdapter>
endpoint=tcp -h 192.168.2.131 -p 19385 -t 60000
allow
maxconns=1024
threads=5
queuecap=10000
queuetimeout=4000
servant=tars.tarsnode.NodeObj
</NodeAdapter>
<ServerAdapter>
endpoint=tcp -h 192.168.2.131 -p 19386 -t 60000
allow
maxconns=1024
threads=5
queuecap=10000
queuetimeout=4000
servant=tars.tarsnode.ServerObj
</ServerAdapter>
</server>
</application>
<node>
registryObj=tars.tarsregistry.RegistryObj
<keepalive>
heartTimeout=60
monitorInterval=2
synStatInterval=300
</keepalive>
<hashmap>
file=serversCache.dat
minBlock=500
maxBlock=500
factor=1
size=10M
</hashmap>
</node>
</tars>
7、tars.tarspatch.config.conf 紅色部分就是要修改的地方
<tars>
directory=/usr/local/app/patchs/tars
uploadDirectory=/usr/local/app/patchs/tars.upload
size=1M
<application>
enableset=n
setdivision=NULL
<server>
[email protected] -h 192.168.2.131 -p 19386 -t 60000
app=tars
server=tarspatch
localip=192.168.2.131
local=tcp -h 127.0.0.1 -p 10000 -t 3000
basepath=/usr/local/app/tars/bin
datapath=/usr/local/app/tars/tarspatch/data
logpath=/usr/local/app/tars/app_log
logsize=10M
config=tars.tarsconfig.ConfigObj
notify=tars.tarsnotify.NotifyObj
deactivating-timeout=3000
logLevel=DEBUG
<tars.tarspatch.PatchObjAdapter>
allow
endpoint=tcp -h 192.168.2.131 -p 10000 -t 6000
handlegroup=tars.tarspatch.PatchObjAdapter
maxconns=20000
protocol=tars
queuecap=10000
queuetimeout=60000
servant=tars.tarspatch.PatchObj
threads=3
</tars.tarspatch.PatchObjAdapter>
</server>
<client>
[email protected] -h registry.tars.com -p 17890
sync-invoke-timeout=3000
async-invoke-timeout=5000
refresh-endpoint-interval=60000
report-interval=60000
sample-rate=100000
max-sample-count=50
asyncthread=3
stat=tars.tarsstat.StatObj
property=tars.tarsproperty.PropertyObj
modulename=tars.tarspatch
</client>
</application>
</tars>
8、tars.tarsregistry.config.conf 紅色部分就是要修改的地方
<tars>
<application>
<client>
locator = [email protected] -h registry.tars.com -p 17890
sync-invoke-timeout=10000
async-invoke-timeout=60000
refresh-endpoint-interval = 60000
stat = tars.tarsstat.StatObj
property = tars.tarsproperty.PropertyObj
report-interval = 60000
asyncthread = 3
modulename = tars.tarsregistry
timeout-queue-size = 100
</client>
<server>
app = tars
server = tarsregistry
localip = 192.168.2.131
basepath = /usr/local/app/tars/tarsregistry/data
datapath = /usr/local/app/tars/tarsregistry/data
logpath = /usr/local/app/tars/app_log
netthread= 2
notify=tars.tarsnotify.NotifyObj
<QueryAdapter>
endpoint = tcp -h 192.168.2.131 -p 17890 -t 10000
allow =
maxconns = 10000
threads = 5
queuecap = 10000
queuetimeout= 4000
servant = tars.tarsregistry.QueryObj
</QueryAdapter>
<RegistryAdapter>
endpoint = tcp -h 192.168.2.131 -p 17891 -t 30000
allow =
maxconns = 2048
threads = 5
queuecap = 10000
queuetimeout= 4000
servant = tars.tarsregistry.RegistryObj
</RegistryAdapter>
</server>
</application>
<db>
dbhost = db.tars.com
dbname = db_tars
dbuser = tars
dbpass = tars2015
dbport = 3306
charset = utf8
dbflag = CLIENT_MULTI_STATEMENTS
</db>
<reap>
#載入object間隔時間(s)
loadObjectsInterval = 30
#輪詢server狀態的間隔時間(s)
queryInterval = 150
#第一階段載入時間間隔,位是秒
loadObjectsInterval1 = 13
#第一階段載入最近時間更新的記錄,預設是60秒
LeastChangedTime1 = 600
#第二階段(全量)載入時間間隔,單位是秒
loadObjectsInterval2 = 3601
#node心跳超時時間,單位是秒
nodeTimeout = 250
#主控心跳超時檢測時間,單位是秒
registryTimeout = 150
#服務狀態監控載入最近時間更新的記錄,單位是秒
querylesttime = 300
#主控心跳關閉開關,預設允許心跳檢測,要遷移的時候設定次項為N
# heartbeatoff=Y
asyncthread = 6
</reap>
<objname>
#patch物件
patchServerObj = tars.tarspatch.PatchObj
#查詢列表物件
QueryObjName = tars.tarsregistry.QueryObj
#node呼叫的Registry物件
RegistryObjName = tars.tarsregistry.RegistryObj
</objname>
<objcache>
min_block = 50
max_block = 200
factor = 1.2
FilePath = /usr/local/app/tars/tarsregistry/util/objectCache.dat
FileSize = 8M
</objcache>
<nodeinfo>
#node預設模板名稱
defaultTemplate = tars.tarsnode
</nodeinfo>
</tars>