Build a host network mode cluster environment based on FiscoBcos v3.0.1 pro version

install software

renew

The latest version of system software

yum update -y

install docker

yum install -y yum-utils device-mapper-persistent-data lvm2

set yum source

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

You can view all docker versions in all warehouses and choose a specific version to install

yum list docker-ce --showduplicates | sort -r

Install

yum install docker-ce-18.06.3.ce-3.el7 -y

start up

systemctl enable docker && systemctl start docker

Configure the mirror accelerator and use the accelerator by modifying the daemon configuration file /etc/docker/daemon.json

mkdir -p /etc/docker

tee /etc/docker/daemon.json <<-'EOF'

{

  "registry-mirrors": ["https://ijdk512y.mirror.aliyuncs.com"]

}

EOF

systemctl daemon-reload && systemctl restart docker

 

Install docker-compose

Run this command to download the current stable release of Docker Compose

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Binary files apply executable permissions

chmod +x /usr/local/bin/docker-compose

create link

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

view version

docker-compose -version

install java

mkdir /usr/local/java && cd /usr/local/java

tar -C /usr/local/java -zxvf jdk-8u321-linux-x64.tar.gz

Configure the Java environment and edit the /etc/profile file

vi /etc/profile

export JAVA_HOME=/usr/local/java/jdk1.8.0_321

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

source /etc/profile

install python3.7

Install dependencies

yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y

mkdir /usr/local/python3

tar -xf Python-3.7.10.tgz && cd Python-3.7.10

编译安装

./configure --prefix=/usr/local/python3

make && make install



建立Python3的软连接

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

Install pykmip etc.

pip3 install pykmip toml requests requests_toolbelt

Upgrade the GCC compiler

yum -y install centos-release-scl

yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils

scl enable devtoolset-8 bash



echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

Upgrade the make version to 4.2

cd /usr/local

tar -xf make-4.2.tar.gz

cd make-4.2

./configure

make

make install

rm -rf /usr/bin/make

cp ./make /usr/bin/

make -v

 

Upgrade GLIBC

Upgrade GLIBCXX

This error occurs because the default GCC version of the current version of CentOS7 is too old, and the dynamic link library in it does not have GLIBCXX_3.4.21 .

cd /usr/local/lib64/

# unzip

unzip libstdc.so_.6.0.26.zip

# Copy the latest downloaded version to /usr/lib64

cp libstdc++.so.6.0.26 /usr/lib64

cd /usr/lib64

# View the version of libstdc++.so.6 link under /usr/lib64

ls -l | grep libstdc++

# Delete the original soft link (you can back it up if you don't worry)

rm libstdc++.so.6

# Use the latest library to establish a soft link

ln -s libstdc++.so.6.0.26 libstdc++.so.6

# Check the new version, success

strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX

Upgrade GLIBC

/usr/local/app/tars/tarsnode/bin/tarsnode: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/app/tars/tarsnode/bin/tarsnode)

This error will cause the tarsnode node service to fail to start.

cd /usr/local/

tar -xf glibc-2.31.tar.gz

cd glibc-2.31

mkdir build

cd build
yum install bison -y

../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

make

make install

strings /usr/lib64/libstdc++.so.6 | grep GLIBC_

 

in host mode

192.168.229.189

20200

30300

192.168.229.190

20201

30301

install tars service

Choose to install the tars service on the 192.168.229.189 server

cd /opt/blockchain/fiscobcosV3

Change setting

1. Modify the docker-compose configuration of tarsFramework, set the password, ip (physical ip), and specify the network card

cd /opt/blockchain/fiscobcosV3/BcosBuilder/docker/host/linux/framework

vi docker-compose.yml

version: "3"

services:

  tars-mysql:

    image: mysql:5.6

    network_mode: "host"

    environment:

      MYSQL_ROOT_PASSWORD: "FISCO"

      MYSQL_TCP_PORT: 3310

    restart: always

    volumes:

      - ~/app/tars/framework-mysql:/var/lib/mysql

      - /etc/localtime:/etc/localtime



  tars-framework:

    image: tarscloud/framework:v3.0.1

    network_mode: "host"

    environment:

      MYSQL_HOST: "192.168.229.189"

      MYSQL_ROOT_PASSWORD: "FISCO"

      MYSQL_PORT: 3310

      REBUILD: "false"

      INET: ens33

      SLAVE: "false"

    restart: always

    volumes:

      - ~/app/tars/framework:/data/tars

      - /etc/localtime:/etc/localtime

    depends_on:

      - tars-mysql

Note: When using the host mode, you need to specify the network card in the INET item of the configuration file, and you can use ip addr to view the network card.

 

If the default network card is used, the following error will occur:

2. Modify the docker-compose configuration of tarsnode

cd /opt/blockchain/fiscobcosV3/BcosBuilder/docker/host/linux/node

vi docker-compose.yml

version: "3"

services:

  tars-node:

    image: tarscloud/tars-node:latest

    network_mode: "host"

    environment:

      INET: ens33

      WEB_HOST: "http://192.168.229.189:3000"

    restart: always

    volumes:

      - ~/app/tars:/data/tars

      - /etc/localtime:/etc/localtime

Create a tars management service

cd /opt/blockchain/fiscobcosV3/BcosBuilder/docker/host/linux/framework

docker-compose up -d

Start the tars management service

cd /opt/blockchain/fiscobcosV3/BcosBuilder/docker/host/linux/framework

docker-compose start

Check

docker ps -a

access

http://192.168.229.189:3000/   admin   

Install tarsnode service (important)

Install tarsnode service for 192.168.229.190 server

Click [Operation and Maintenance Management] -> [Node Management] -> [Auto Install Node], fill in the server ip, login user/password;

First [Test Connectivity], after the connection is successful, click [Install];

View on the 192.168.229.190 server;

ps -ef | grep tars

So far the tarsnode service on the 192.168.229.190 server has been installed successfully.

Apply for a token

【User Center】 -> 【Token Management】 -> 【Add Token】

 

Deploy the Pro version blockchain node

download binary

cd /opt/blockchain/fiscobcosV3/BcosBuilder/pro

python3 build_chain.py download_binary

 

Modify the configuration file

Modify the ip and token in the configuration file . You can refer to the official document for modification .

cp conf/config-deploy-example.toml config.toml

vi config.toml

[tars]

tars_url = "http://192.168.229.189:3000"

tars_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJhZG1pbiIsImlhdCI6MTY2ODA1ODI3NCwiZXhwIjoxNzYyODM5MDc0fQ.6wl-tvAJTLZk4YFdw9GQPJHh4aVZxESH8GaEMBdHsk4"

tars_pkg_dir = "binary/"



[chain]

chain_id="chain0"

# the rpc-service enable sm-ssl or not, default disable sm-ssl

rpc_sm_ssl=false

# the gateway-service enable sm-ssl or not, default disable sm-ssm

gateway_sm_ssl=false

# the existed rpc service ca path, will generate new ca if not configured

#rpc_ca_cert_path=""

# the existed gateway service ca path, will generate new ca if not configured

#gateway_ca_cert_path="



[[group]]

group_id="group0"

# the genesis configuration path of the group, will generate new genesis configuration if not configured

# genesis_config_path = ""

# VM type, now only support evm/wasm

vm_type="evm"

# use sm-crypto or not

sm_crypto=false

# enable auth-check or not

auth_check=false

init_auth_address=""



# the genesis config

# the number of blocks generated by each leader

leader_period = 1

# the max number of transactions of a block

block_tx_count_limit = 1000

# consensus algorithm now support PBFT(consensus_type=pbft)

consensus_type = "pbft"

# transaction gas limit

gas_limit = "3000000000"

# compatible version, can be dynamically upgraded through setSystemConfig

# the default is 3.0.0-rc4

compatibility_version="3.0.0"



[[agency]]

name = "agencyA"

# enable data disk encryption for rpc/gateway or not, default is false

enable_storage_security = false

# url of the key center, in format of ip:port, please refer to https://github.com/FISCO-BCOS/key-manager for details

# key_center_url =

# cipher_data_key =



    [agency.rpc]

    deploy_ip=["192.168.229.189"]

    listen_ip="0.0.0.0"

    listen_port=20200

    thread_count=4



    [agency.gateway]

    deploy_ip=["192.168.229.189"]

    listen_ip="0.0.0.0"

    listen_port=30300

    peers=["192.168.229.189:30300", "192.168.229.190:30301"]



    [[agency.group]]

        group_id = "group0"

        [[agency.group.node]]

        node_name = "node0"

        deploy_ip = "192.168.229.189"

        # enable data disk encryption for bcos node or not, default is false

        enable_storage_security = false

        # url of the key center, in format of ip:port, please refer to https://github.com/FISCO-BCOS/key-manager for details

        # key_center_url =

        # cipher_data_key =

        monitor_listen_port = "3902"

        # monitor log path example:"/home/fisco/tars/framework/app_log/"

        monitor_log_path = ""



[[agency]]

name = "agencyB"

# enable data disk encryption for rpc/gateway or not, default is false

enable_storage_security = false

# url of the key center, in format of ip:port, please refer to https://github.com/FISCO-BCOS/key-manager for details

# key_center_url =

# cipher_data_key =



    [agency.rpc]

    deploy_ip=["192.168.229.190"]

    listen_ip="0.0.0.0"

    listen_port=20201

    thread_count=4



    [agency.gateway]

    deploy_ip=["192.168.229.190"]

    listen_ip="0.0.0.0"

    listen_port=30301

    peers=["192.168.229.189:30300", "192.168.229.190:30301"]



    [[agency.group]]

        group_id = "group0"

        

        [[agency.group.node]]

        node_name = "node0"

        deploy_ip = "192.168.229.190"

        # enable data disk encryption for bcos node or not, default is false

        enable_storage_security = false

        # url of the key center, in format of ip:port, please refer to https://github.com/FISCO-BCOS/key-manager for details

        # key_center_url =

        # cipher_data_key =

        monitor_listen_port = "3901"

        # monitor log path example:"/home/fisco/tars/framework/app_log/"

        monitor_log_path = ""

Deploy RPC service

cd /opt/blockchain/fiscobcosV3/BcosBuilder/pro

Deploy and start the RPC service

python3 build_chain.py chain -o deploy -t rpc

 

Deploy the Gateway service

cd /opt/blockchain/fiscobcosV3/BcosBuilder/pro

Deploy and start the Gateway service

python3 build_chain.py chain -o deploy -t gateway

 

Deploy blockchain node service

cd /opt/blockchain/fiscobcosV3/BcosBuilder/pro

Deploy and start the blockchain node service

python3 build_chain.py chain -o deploy -t node

 

deployment console

Deploy the console on the 192.168.229.190 server

Copy the certificate of /opt/blockchain/fiscobcosV3/BcosBuilder/pro/generated/rpc/chain0/agencyBBcosRpcService/192.168.229.190/sdk/ under the 192.168.229.189 server directory to /opt/blockchain/fiscobcos/V3/con of the 192.168.229.190 server conf directory

cp -n config-example.toml config.toml

vi config.toml


[network]

messageTimeout = "10000"

defaultGroup="group0"                            # Console default group to connect

peers=["127.0.0.1:20201"]    # The peer list to connect

Start the console, deploy the HelloWorld contract and execute the contract.

./start.sh

So far, the host network mode of FiscoBcos v3.0.1 pro version has been deployed successfully!

Guess you like

Origin blog.csdn.net/yuch_hong/article/details/127796576