Giter Site home page Giter Site logo

Comments (18)

ruanshudong avatar ruanshudong commented on May 24, 2024

虚拟网络, 跨机器了?

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

虚拟网络, 跨机器了?

我这个是虚拟机网络吗?
我是两台局域网的实体机

from tars.

ruanshudong avatar ruanshudong commented on May 24, 2024

docker虚拟网络, 不同机器不通, 你可以先了解一下docker, 如果有多台机器, 不如就用--net=host

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

network_mode: "host"

我的这个docker-compose配置是使用的host模式吧?

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

并且我并没有使用docker开启虚拟网段

from tars.

ruanshudong avatar ruanshudong commented on May 24, 2024

你这个ip是机器实际的ip么?

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

tars主节点局域网IP:10.10.141.57 mysql和framework都在这个机器的docker
node节点局域网IP:10.10.145.76

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

image
image

from tars.

ruanshudong avatar ruanshudong commented on May 24, 2024

那不应该不通, 只能检查一下tarsnode日志看看

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

这个是tarsnode的docker日志

docker logs dedd4ac314b8
--2023-11-22 10:28:08--  http://10.10.141.57:3000/get_tarsnode?ip=&runuser=root&registryAddress=
Connecting to 10.10.141.57:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3458 (3.4K) [text/plain]
Saving to: 'get_tarsnode.sh'

     0K ...                                                   100% 2.47G=0s

2023-11-22 10:28:08 (2.47 GB/s) - 'get_tarsnode.sh' saved [3458/3458]

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://10.10.141.57:3000, machine_ip:10.10.145.76, registryAddress:tcp -h 10.10.141.57 -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://10.10.141.57:3000/files/tarsnode.tgz

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

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

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

if [ '10.10.145.76' == '' ]; 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:[10.10.145.76] succ"

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

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

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

if [ $OS != 3 ]; then
    sed -i "s/registryAddress/tcp -h 10.10.141.57 -p 17890/g" ${TARS_PATH}/tarsnode/util/execute.sh
    sed -i "s/localip.tars.com/10.10.145.76/g" ${TARS_PATH}/tarsnode/util/execute.sh
else
    sed -i "s/registryAddress/tcp -h 10.10.141.57 -p 17890/g" ${TARS_PATH}/tarsnode/util/execute.bat
    sed -i "s/localip.tars.com/10.10.145.76/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://10.10.141.57:3000, machine_ip:10.10.145.76, registryAddress:tcp -h 10.10.141.57 -p 17890
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1323k    0 1323k    0     0  92.3M      0 --:--:-- --:--:-- --:--:-- 92.3M
cp: cannot overwrite non-directory '/usr/local/app/tars/tarsnode/data' with directory 'tarsnode/data'
local machine ip:[10.10.145.76] succ
tars registry: tcp -h 10.10.141.57 -p 17890
install tarsnode succ, start tarsnode
start /usr/local/app/tars/tarsnode/bin/tarsnode --nodeid=10.10.145.76 --config=/usr/local/app/tars/tarsnode/conf/tars.tarsnode.config.conf
Tars node installed success
tarsnode.conf: --------------------------------------------------------
<tars>
    <application>
        enableset=n
        setdivision=NULL
        <client>
            async-invoke-timeout=5000
            refresh-endpoint-interval=60000
            report-interval=60000
            stat=tars.tarsstat.StatObj
            property=tars.tarsproperty.PropertyObj
            modulename=tars.tarsnode
            locator=tars.tarsregistry.QueryObj@tcp -h 10.10.141.57 -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=10.10.145.76
            local=tcp -h 127.0.0.1 -p 19387 -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 10.10.145.76 -p 19385 -t 60000
                allow
                maxconns=1024
                threads=5
                queuecap=10000
                queuetimeout=4000
                servant=tars.tarsnode.NodeObj
            </NodeAdapter>
            <ServerAdapter>
                endpoint=tcp -h 10.10.145.76 -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=45
                monitorInterval=3
                synStatInterval=60
            </keepalive>
            <hashmap>
                file=serversCache.dat
                minBlock=500
                maxBlock=500
                factor=1
                size=10M
            </hashmap>
    </node>
</tars>
install tarsnode succ, check tarsnode alive
--2023-11-22 10:33:24--  http://10.10.141.57:3000/get_tarsnode?ip=&runuser=root&registryAddress=
Connecting to 10.10.141.57:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3458 (3.4K) [text/plain]
Saving to: 'get_tarsnode.sh'

     0K ...                                                   100% 2.18G=0s

2023-11-22 10:33:24 (2.18 GB/s) - 'get_tarsnode.sh' saved [3458/3458]

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://10.10.141.57:3000, machine_ip:10.10.145.76, registryAddress:tcp -h 10.10.141.57 -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://10.10.141.57:3000/files/tarsnode.tgz

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

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

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

if [ '10.10.145.76' == '' ]; 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:[10.10.145.76] succ"

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

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

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

if [ $OS != 3 ]; then
    sed -i "s/registryAddress/tcp -h 10.10.141.57 -p 17890/g" ${TARS_PATH}/tarsnode/util/execute.sh
    sed -i "s/localip.tars.com/10.10.145.76/g" ${TARS_PATH}/tarsnode/util/execute.sh
else
    sed -i "s/registryAddress/tcp -h 10.10.141.57 -p 17890/g" ${TARS_PATH}/tarsnode/util/execute.bat
    sed -i "s/localip.tars.com/10.10.145.76/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://10.10.141.57:3000, machine_ip:10.10.145.76, registryAddress:tcp -h 10.10.141.57 -p 17890
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1323k    0 1323k    0     0  92.3M      0 --:--:-- --:--:-- --:--:-- 92.3M
cp: cannot overwrite non-directory '/usr/local/app/tars/tarsnode/data' with directory 'tarsnode/data'
local machine ip:[10.10.145.76] succ
tars registry: tcp -h 10.10.141.57 -p 17890
install tarsnode succ, start tarsnode
start /usr/local/app/tars/tarsnode/bin/tarsnode --nodeid=10.10.145.76 --config=/usr/local/app/tars/tarsnode/conf/tars.tarsnode.config.conf
Tars node installed success
tarsnode.conf: --------------------------------------------------------
<tars>
    <application>
        enableset=n
        setdivision=NULL
        <client>
            async-invoke-timeout=5000
            refresh-endpoint-interval=60000
            report-interval=60000
            stat=tars.tarsstat.StatObj
            property=tars.tarsproperty.PropertyObj
            modulename=tars.tarsnode
            locator=tars.tarsregistry.QueryObj@tcp -h 10.10.141.57 -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=10.10.145.76
            local=tcp -h 127.0.0.1 -p 19387 -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 10.10.145.76 -p 19385 -t 60000
                allow
                maxconns=1024
                threads=5
                queuecap=10000
                queuetimeout=4000
                servant=tars.tarsnode.NodeObj
            </NodeAdapter>
            <ServerAdapter>
                endpoint=tcp -h 10.10.145.76 -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=45
                monitorInterval=3
                synStatInterval=60
            </keepalive>
            <hashmap>
                file=serversCache.dat
                minBlock=500
                maxBlock=500
                factor=1
                size=10M
            </hashmap>
    </node>
</tars>
install tarsnode succ, check tarsnode alive
[root@bogon node]#

from tars.

ruanshudong avatar ruanshudong commented on May 24, 2024

进入容器, 查看 /usr/local/app/tars/app_log/tars/tarsnode/....下面的日志, 看看是否有异常

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

image
image
image
Uploading image.png…

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

image

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

看一下最后一张图有Error

from tars.

ruanshudong avatar ruanshudong commented on May 24, 2024

看起来是似乎没问题啊, 是不是防火墙哪里有问题

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

就是防火墙问题,那我不能关闭防火墙吧?有什么好的办法吗?

from tars.

Lands-1203 avatar Lands-1203 commented on May 24, 2024

tars-node的防火墙关闭就可以了

from tars.

ruanshudong avatar ruanshudong commented on May 24, 2024

防火墙开通内网啊, 内网要啥防火墙

from tars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.