TarsCloud / Tars

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
BSD 3-Clause "New" or "Revised" License
9.79k stars 2.08k forks source link

Docker正常部署tarsnode后,tarsnode无法被框架发现。 #826

Closed edward-golang closed 3 years ago

edward-golang commented 3 years ago

框架的管理后台是:192.168.163.128:3000 我用另一台虚拟机(ip:192.168.163.129)部署tarsnode,下面是部署命令: docker run \ --name=tars-node \ --net=host \ -e INET=ens33 \ -e WEB_HOST="192.168.163.128:3000" \ -v /root/work/docker/tars/node/data:/data/app \ -v /etc/localtime:/etc/localtime \ tarscloud/tars-node:full

下面是报错:

[root@localhost data]# docker run --name=tars-node --net=host -e INET=ens33 -e WEB_HOST="192.168.163.128:3000" -v /root/work/docker/tars/node/data:/data/app -v /etc/localtime:/etc/localtime tarscloud/tars-node:full --2020-11-08 00:12:36-- http://192.168.163.128:3000/get_tarsnode?ip=&runuser=root Connecting to 192.168.163.128:3000... connected. HTTP request sent, awaiting response... 200 OK Length: 3503 (3.4K) [text/plain] Saving to: 'get_tarsnode.sh'

 0K ...                                                   100%  221M=0s

2020-11-08 00:12:36 (221 MB/s) - 'get_tarsnode.sh' saved [3503/3503]

get_tarsnode.sh: --------------------------------------------------------

!/bin/bash

/**

* Tencent is pleased to support the open source community by making Tars available.

*

* Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.

*

* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except

* in compliance with the License. You may obtain a copy of the License at

*

* https://opensource.org/licenses/BSD-3-Clause

*

* Unless required by applicable law or agreed to in writing, software distributed

* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR

* CONDITIONS OF ANY KIND, either express or implied. See the License for the

* specific language governing permissions and limitations under the License.

*/

echo "runuser: root, webHost:http://192.168.163.128:3000, machine_ip:192.168.163.129, registryAddress:tcp -h 192.168.163.128 -p 17890"

OSNAME=uname OS=1

if [[ "$OSNAME" == "Darwin" ]]; then OS=2 elif [[ "$OSNAME" == "Windows_NT" ]]; then OS=3 else OS=1 fi

if [ $OS != 3 ]; then TARS_PATH=/usr/local/app/tars else TARS_PATH=c:/tars-install/tars fi

if [ $OS != 3 ]; then if [ ! -d "/usr/local/app" ]; then echo "create tars base path: " mkdir -p /data/app ln -s /data/app /usr/local/app fi fi

mkdir -p ${TARS_PATH}

rm -rf tarsnode.tgz

curl -O http://192.168.163.128:3000/files/tarsnode.tgz

休息1s, 避免下载的文件没有写成功

sleep 1

if [ ! -f "tarsnode.tgz" ]; then echo "Tars node download error: http://192.168.163.128:3000/files/tarsnode.tgz" exit fi

if [ 'tcp -h 192.168.163.128 -p 17890' == '' ]; then echo "registryAddress is empty." exit fi

if [ '192.168.163.129' == '' ]; then echo "machine_ip is empty." exit fi

tar zxf tarsnode.tgz

if [ $OS != 3 ]; then if [ -f ${TARS_PATH}/tarsnode/util/stop.sh ]; then ${TARS_PATH}/tarsnode/util/stop.sh fi else if [ -f ${TARS_PATH}/tarsnode/util/stop.bat ]; then ${TARS_PATH}/tarsnode/util/stop.bat fi fi

cp -rf tarsnode ${TARS_PATH}/

cd ${TARS_PATH}

echo "local machine ip:[192.168.163.129] succ"

echo "tars registry:" tcp -h 192.168.163.128 -p 17890

sed -i "s/localip.tars.com/192.168.163.129/g" ${TARS_PATH}/tarsnode/conf/tars.tarsnode.config.conf

sed -i "s/registryAddress/tcp -h 192.168.163.128 -p 17890/g" ${TARS_PATH}/tarsnode/conf/tars.tarsnode.config.conf

if [ $OS != 3 ]; then sed -i "s/registryAddress/tcp -h 192.168.163.128 -p 17890/g" ${TARS_PATH}/tarsnode/util/execute.sh sed -i "s/localip.tars.com/192.168.163.129/g" ${TARS_PATH}/tarsnode/util/execute.sh else sed -i "s/registryAddress/tcp -h 192.168.163.128 -p 17890/g" ${TARS_PATH}/tarsnode/util/execute.bat sed -i "s/localip.tars.com/192.168.163.129/g" ${TARS_PATH}/tarsnode/util/execute.bat fi echo "install tarsnode succ, start tarsnode"

if [ $OS != 3 ]; then id -u root &>/dev/null if [ $? != 0 ]; then useradd root fi chown -R root:root /usr/local/app/*;

${TARS_PATH}/tarsnode/util/stop.sh

uid=`whoami`
if [ "$uid" != "root" ] && [ "root" != "" ]; then
    echo "su $runuser: now uid:$uid, runuser:$runuser"
    su - $runuser -c "sh ${TARS_PATH}/tarsnode/util/start.sh"
else
    sh ${TARS_PATH}/tarsnode/util/start.sh
fi

else ${TARS_PATH}/tarsnode/util/start.bat fi

INFO=ps -e | grep tarsnode

if [[ "${INFO}" != "" ]]; then echo 'Tars node installed success' else echo 'Tars node installed failed' fi runuser: root, webHost:http://192.168.163.128:3000, machine_ip:192.168.163.129, registryAddress:tcp -h 192.168.163.128 -p 17890 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1201k 0 1201k 0 0 13.3M 0 --:--:-- --:--:-- --:--:-- 13.4M cp: cannot overwrite non-directory '/usr/local/app/tars/tarsnode/data' with directory 'tarsnode/data' local machine ip:[192.168.163.129] succ tars registry: tcp -h 192.168.163.128 -p 17890 install tarsnode succ, start tarsnode start /usr/local/app/tars/tarsnode/bin/tarsnode --nodeid=192.168.163.129 --config=/usr/local/app/tars/tarsnode/conf/tars.tarsnode.config.conf Tars node installed success tarsnode.conf: --------------------------------------------------------

enableset=n setdivision=NULL 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 locator=tars.tarsregistry.QueryObj@tcp -h 192.168.163.128 -p 17890 sync-invoke-timeout=6000 asyncthread=3 logsize=10M config=tars.tarsconfig.ConfigObj notify=tars.tarsnotify.NotifyObj deactivating-timeout=3000 app=tars server=tarsnode localip=192.168.163.129 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 endpoint=tcp -h 192.168.163.129 -p 19385 -t 60000 allow maxconns=1024 threads=5 queuecap=10000 queuetimeout=4000 servant=tars.tarsnode.NodeObj endpoint=tcp -h 192.168.163.129 -p 19386 -t 60000 allow maxconns=1024 threads=5 queuecap=10000 queuetimeout=4000 servant=tars.tarsnode.ServerObj registryObj=tars.tarsregistry.RegistryObj heartTimeout=45 monitorInterval=3 synStatInterval=60 file=serversCache.dat minBlock=500 maxBlock=500 factor=1 size=10M

install tarsnode succ, check tarsnode alive MonitorNode ok, latestKeepAliveTime:1604823159, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823159, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823166, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823166, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823173, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823173, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823173, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823180, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823180, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823187, kaTimeout:300 MonitorNode ok, latestKeepAliveTime:1604823187, kaTimeout:300

请问,这是什么原因?要怎么排查问题?谢谢!

edward-golang commented 3 years ago

补充:transnode的机器一直打印 MonitorNode ok 。。。的log;但框架后台的 节点管理 中没有显示192.168.163.129的节点信息。

edward-golang commented 3 years ago

补充:把两台机器的防火墙关了后,在tasweb管理后台就可以看到新增的tarsnode了。。。;请问在多机器的环境中,framework要开放哪些端口才能确保tarsnode能正常接入?

ruanshudong commented 3 years ago

可以看看framework/deploy/Dockfile文件, 里面都有端口说明

tarscloudbot commented 3 years ago

该issue长期未更新。如果问题依旧没解决,欢迎重新打开issue。TARS社区有您更精彩。

Thanks for your supporting. The issue has not been updated for a long time. If the problem is still not resolved, welcome to reopen the issue.