1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Monero CPU Mining with Docker Swarm Mode

Discussion in 'Software Stuff' started by Patrick, Jan 30, 2017.

  1. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    10,582
    Likes Received:
    3,650
    We recently released an image and guide for CPU Monero Mining with Docker. That works well for one system. What happens when you have a number of servers and want to put them to use during what would otherwise be downtime? Today we have a simple guide for getting this working.

    If you are new to Docker swarm post-Docker 1.12, you can get up and running within 2-3 minutes.
    Here is our Getting Docker Swarm Running in Minutes guide

    Once this is setup, the actual process is exceedingly simple. Here we are taking a swarm that encompasses 4-nodes in a 2U chassis and we are making each node mine Monero.

    Code:
    docker service create --mode global --name m_test_01 -e username=example@example.com servethehome/monero_cpu_minergate
    Key aspects to this:
    • We have 4 nodes. By default, Docker will try to run one replica on each node. Therefore, we could use --replicas 4. Instead, we are using --mode global to replicate on every node in our swarm. This is important since if we power off a node, Docker will try to re-balance and place a second mining container on a node.
    • We did give this service a name. You will want to kill this service when it is time to utilize the machines for normal production workloads. In this case we are using --name m_test_01 but you can use whatever you want there
    • We are using our minergate CPU mining image. You will need to replace "example@example.com" with your minergate username.
    There are a few constraints with this approach. The biggest is that this is the "quick and dirty" way to target nodes. We are not using any filtering to target specific nodes.

    We will soon have a cleaner way to manage mining along with your existing Docker services. In the meantime, using this method you can boot to an image that is part of the docker swarm and then automatically start mining Monero on the nodes. Once a node re-joins the swarm, it will automatically start running the mining image. You can also use commands such as:
    Code:
    $ docker service ls
    ID            NAME       MODE    REPLICAS  IMAGE
    uo4h4vpa5oid  m_test_04  global  4/4       servethehome/monero_cpu_minergate:latest
    And see how many miners are running.
     
    #1
    Last edited: Feb 1, 2017
    eva2000 and gigatexal like this.
  2. chilipepperz

    chilipepperz Active Member

    Joined:
    Mar 17, 2016
    Messages:
    130
    Likes Received:
    36
    Nice! I just tried this with a 10 node build cluster and worked like a charm.
     
    #2
  3. Marcos Laue

    Marcos Laue New Member

    Joined:
    Jun 5, 2017
    Messages:
    9
    Likes Received:
    1
    Using that Docker swarm image, there's advantage on h/s(performance of mining) comparing to just docker (Monero CPU Mining in Docker) based on a vps with 2 or 4 cores?
     
    #3
  4. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    10,582
    Likes Received:
    3,650
    Same images now. Just management via Swarm. At 1-2 nodes, no need for swarm. By the time you are at 20+ having some sort of orchestration is very helpful.
     
    #4
  5. im10er

    im10er New Member

    Joined:
    Feb 11, 2018
    Messages:
    8
    Likes Received:
    0
    Can you update it to use merged mining? minerd -a cryptonight -o stratum+tcp://fcn-xmr.pool.minergate.com:45590 -u email@example.com -p x
     
    #5
  6. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    10,582
    Likes Received:
    3,650
    #6
  7. im10er

    im10er New Member

    Joined:
    Feb 11, 2018
    Messages:
    8
    Likes Received:
    0
    Sorry am I misunderstanding?

    docker service create --mode global --name monero -e username=<wallet> -e pool="fcn-xmr.pool.minergate.com" -e startport=45590 -e workerid=`hostname` servethehome/universal_cryptonight

    /usr/local/bin/xmrig.sh: line 96: 361 Illegal instruction (core dumped) ./xmrig -a cryptonight --av=1 --nicehash -o stratum+tcp://$pool:$startport -u $username.$workerid -p $pass -t $numthreads
     
    #7
    Last edited: Feb 12, 2018
  8. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    10,582
    Likes Received:
    3,650
    I wonder if it is mixing the quotes that you are using in the launch line.
     
    #8
  9. im10er

    im10er New Member

    Joined:
    Feb 11, 2018
    Messages:
    8
    Likes Received:
    0
    I think it had to do with the AES-NI issue again. Earlier when I was trying to run cpuminer I was getting an error with my manager node because it didn't have AES-NI

    [ANN]: cpuminer-opt v3.8.1, open source optimized multi-algo CPU miner

    I started a new manager and removed the other one and everything started working properly. Although I didn't test it with `hostname`... which can you explain to a noob, does that work in order for me to pass in my hostname as the worker?
     
    #9
  10. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    10,582
    Likes Received:
    3,650
  11. Joel

    Joel Active Member

    Joined:
    Jan 30, 2015
    Messages:
    532
    Likes Received:
    105
    Can the manager node also be a worker?
     
    #11
Similar Threads: Monero Mining
Forum Title Date
Software Stuff AMD Ryzen 7, AMD RX 480 and RX 470 Monero Mining Results and Insights Mar 12, 2017
Software Stuff Best AMD RX 470 rawintensity Monero Testing Mar 12, 2017
Software Stuff Best AMD RX 480 rawintensity Monero Testing Mar 12, 2017
Software Stuff Zcash getting started with CPU mining (easily) Nov 14, 2016

Share This Page