# How can I run 2 nodes in 1 Server?

**URL:** <https://community.creditcoin.org/t/how-can-i-run-2-nodes-in-1-server/237>\
**Category:** Mining\
**Created:** [March 15, 2021, 4:04pm UTC](https://community.creditcoin.org/t/how-can-i-run-2-nodes-in-1-server/237 "2021-03-15T16:04:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![woosungchoi](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.creditcoin.org/woosungchoi/32/179_2.png) [@woosungchoi](https://community.creditcoin.org/u/woosungchoi)\
**Post date:** [March 15, 2021, 4:04pm UTC](https://community.creditcoin.org/t/how-can-i-run-2-nodes-in-1-server/237/1 "2021-03-15T16:04:59Z")

</div>

Currently I am digging well with 1 node.

However, my server has a high specification, so I want to operate two nodes.

Here is my second Server’s docker-compose.yml.

```auto
#	Copyright(c) 2018 Gluwa, Inc.
#
#	This file is part of Creditcoin.
#
#	Creditcoin is free software: you can redistribute it and/or modify
#	it under the terms of the GNU Lesser General Public License as published by
#	the Free Software Foundation, either version 3 of the License, or
#	(at your option) any later version.
#	
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#	GNU Lesser General Public License for more details.
#	
#	You should have received a copy of the GNU Lesser General Public License
#	along with Creditcoin. If not, see <https://www.gnu.org/licenses/>.

version: "3.7"

services:

  settings-tp2:
    image: hyperledger/sawtooth-settings-tp:1.2
    container_name: sawtooth-settings-tp-default2
    depends_on:
      - validator2
    entrypoint: settings-tp -C tcp://validator2:4005
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

  validator2:
    image: gluwa/creditcoin-validator:latest
    container_name: sawtooth-validator-default2
    volumes:
      - type: volume
        source: validator-block-volume2
        target: /var/lib/sawtooth/
      - type: volume
        source: validator-key-volume2
        target: /etc/sawtooth/keys/
    expose:
      - 4005
      - 8801
    ports:
      - 4005:4005
      - 8801:8801
    secrets:
     - source: validator_logging2
       target: /etc/sawtooth/log_config.toml
    entrypoint: |
        bash -c 'if [[! -f /etc/sawtooth/keys/validator.pub]]
            then 
                echo "First run"
                sawadm keygen
            fi
            sawtooth-validator \
                --endpoint tcp://my-ip:8801 \
                --bind component:tcp://eth0:4005 \
                --bind network:tcp://eth0:8801 \
                --peering dynamic \
                --seeds tcp://node-000.creditcoin.org:8800 \
                --seeds tcp://node-001.creditcoin.org:8800 \
                --seeds tcp://node-002.creditcoin.org:8800 \
                --seeds tcp://node-003.creditcoin.org:8800 \
                --seeds tcp://creditcoin-node.gluwa.com:8800 \
                --seeds tcp://creditcoin-gateway.gluwa.com:8800 \
                --seeds tcp://118.27.14.197:8800 \
                --seeds tcp://118.27.20.120:8800 \
                --seeds tcp://160.251.9.11:8800 \
                --seeds tcp://160.251.9.75:8800 \
                --seeds tcp://160.251.10.137:8800 \
                --seeds tcp://160.251.13.5:8800 \
                --maximum-peer-connectivity 5 \
                --scheduler parallel'
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "100m"
    networks:
      - default2

  rest-api2:
    image: hyperledger/sawtooth-rest-api:1.2
    container_name: sawtooth-rest-api-default2
    ports:
      - 8809:8809
    secrets:
     - source: rest_api_logging2
       target: /etc/sawtooth/log_config.toml
    depends_on:
      - validator2
    entrypoint: sawtooth-rest-api -C tcp://validator2:4005 --bind rest-api2:8809
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

  processor2:
    image: gluwa/creditcoin-processor:latest
    container_name: creditcoin-processor2
    depends_on:
      - validator2
      - settings-tp2
      - rest-api2
    entrypoint: |
        bash -c 'rest_status=$$(curl -s --head -w %{http_code} http://rest-api2:8809/state?address=000000 -o /dev/null)
            while ["$$rest_status" != "200"]
            do
                echo $$rest_status
                sleep 2
                rest_status=$$(curl -s --head -w %{http_code} http://rest-api2:8809/state?address=000000 -o /dev/null)
            done
            ./ccprocessorLinux.out tcp://validator2:4005 tcp://gateway2:55556 http://rest-api2:8809'
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

  gateway2:
    image: gluwa/creditcoin-gateway:latest
    container_name: creditcoin-gateway2
    expose:
      - 55556
    ports:
      - 55556:55556
    secrets:
      - source: gateway_config2
        target: /home/Creditcoin/Gateway/appsettings.json
    entrypoint: ./ccgateway
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

secrets:
  gateway_config2:
    file: ./gatewayConfig.json
  rest_api_logging2:
    file: ./rest_api-log_config.toml
  validator_logging2:
    file: ./validator-log_config.toml

volumes:
  validator-block-volume2:
  validator-key-volume2:

networks:
  default2:
    driver: bridge

```

But, when I enter docker-compose up, there is something error about 503.

```auto
~/CreditcoinDocs-Mainnet2/Server# docker-compose up
WARNING: Found orphan containers (sawtooth-settings-tp-default, sawtooth-validator-default, creditcoin-processor, sawtooth-rest-api-default, creditcoin-gateway) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting creditcoin-gateway2 ... done
Recreating sawtooth-validator-default2 ... done
Recreating sawtooth-settings-tp-default2 ... done
Recreating sawtooth-rest-api-default2 ... done
Recreating creditcoin-processor2 ... done
Attaching to creditcoin-gateway2, sawtooth-validator-default2, sawtooth-settings-tp-default2, sawtooth-rest-api-default2, creditcoin-processor2
sawtooth-validator-default2 | [2021-03-15 15:54:07.650 WARNING cli] Network key pair is not configured, Network communications between validators will not be authenticated or encrypted.
sawtooth-validator-default2 | [2021-03-15 15:54:07.650 WARNING cli] Network key pair is not configured, Network communications between validators will not be authenticated or encrypted.
creditcoin-processor2 | 503
creditcoin-processor2 | 503
creditcoin-processor2 | 503
creditcoin-processor2 | 503

```

503 means, there is no snapshot files. But I copied.

```auto
cp /var/lib/docker/volumes/server_validator-block-volume/_data/* /var/lib/docker/volumes/server_validator-block-volume2/_data

```

How can I solve this problem?

---

<div class="post-metadata">

**Author:** ![sword](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@sword](https://community.creditcoin.org/u/sword)\
**Post date:** [March 17, 2021, 12:28am UTC](https://community.creditcoin.org/t/how-can-i-run-2-nodes-in-1-server/237/2 "2021-03-17T00:28:51Z")

</div>

Hi, woosungchoi.

It seems that you are not using multi-core to mining.  
How about multi-core mining using following script?  
It will be better than multiple virtual nodes in my thought.

> [@CPU 코어 부하경감법 (An way to offload CPU single core load to others by Glenn)](http://community.creditcoin.org/t/cpu-an-way-to-offload-cpu-single-core-load-to-others-by-glenn/76):
>
> 안녕하세요. (Hello.) Glenn이 validator process의 경우 CPU 코어 하나에만 부하가 집중되는 현상을 해결하는 방법을 개발했고, 시험결과 코어별 부하가 균등하게 분배되는 것을 확인하여 공유드리고자 합니다. (Thanks to Glenn’s hard work, CPU single core load of validator process was distributed evenly over CPU cores, and I found that it works. Great work, Glenn!) 아래와 같이 하시면 됩니다. (Here is the way.) yaml파일을 백업하세요. (Backup your yaml file. ) cp creditcoin-with-gateway.yaml creditcoin-with-gateway.yaml.bak 일단 도커 컨테이너를 종료합니다. (First, Terminate Docker containers. ) …

I don’t know the reason of 503, but multiple virtual machines on single server is not described on manual. So I think that it is not recommended.

---

<div class="post-metadata">

**Author:** ![woosungchoi](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.creditcoin.org/woosungchoi/32/179_2.png) [@woosungchoi](https://community.creditcoin.org/u/woosungchoi)\
**Post date:** [March 17, 2021, 5:02am UTC](https://community.creditcoin.org/t/how-can-i-run-2-nodes-in-1-server/237/3 "2021-03-17T05:02:09Z")

</div>

Okay. I will try it. Thx.
