Author

Topic: Bitmain Antminer step by step how to setup Balance Mining Tutorial (Read 12751 times)

newbie
Activity: 1
Merit: 0
this also works at antminer L3+ or D3?
newbie
Activity: 28
Merit: 0
This post inspired me to experiment with managing more than 3 pools through the web interface. Here's my result https://bitcointalksearch.org/topic/antminer-s1-managing-more-than-3-pools-from-the-web-interface-623672.

FM
newbie
Activity: 7
Merit: 0
Here's a mod to "/etc/init.d/cgminer" which will allow you to turn on/off load balance with quota using the web interface while still allowing default failover mode.

With this mod, you can still use the web interface to configure the mining pool as normal, using the default failover mode.

However, if enter in quota information for pool1 using web interface, like "65;stratum.mining.eligius.st:3334", then restart will automatically switch to load balance mode.  Note: you need to enter quota info for pool2 or pool3 if not blank.  For example:
65;stratum.mining.eligius.st:3334
35;pool2.xxx.com:3333
0;pool3.xxx.com:3333

In the above case, pool3 will only be used as failover.

To make the change, vi /etc/init.d/cgminer and search for:

        if [ "$_pool1url" != "" -a "$_pool1user" != "" -a "$_pool1pw" != "" ]; t
            POOL1="-o $_pool1url -O $_pool1user:$_pool1pw"
        fi
        if [ "$_pool2url" != "" -a "$_pool2user" != "" -a "$_pool2pw" != "" ]; t
            POOL2="-o $_pool2url -O $_pool2user:$_pool2pw"
        fi
        if [ "$_pool3url" != "" -a "$_pool3user" != "" -a "$_pool3pw" != "" ]; t
            POOL3="-o $_pool3url -O $_pool3user:$_pool3pw"
        fi

Replace it with:

# RMC switch to load balance if quota is found on pool1
pool_switch="-o"
custom_option=
test_load_balance=`expr index "$_pool1url" ";"`
if [ "$test_load_balance" != 0 ]; then
   pool_switch="-U"
   custom_option="--load-balance"
fi

        if [ "$_pool1url" != "" -a "$_pool1user" != "" -a "$_pool1pw" != "" ]; t
            POOL1="$pool_switch $_pool1url -O $_pool1user:$_pool1pw"
        fi
        if [ "$_pool2url" != "" -a "$_pool2user" != "" -a "$_pool2pw" != "" ]; t
            POOL2="$pool_switch $_pool2url -O $_pool2user:$_pool2pw"
        fi
        if [ "$_pool3url" != "" -a "$_pool3user" != "" -a "$_pool3pw" != "" ]; t
            POOL3="$pool_switch $_pool3url -O $_pool3user:$_pool3pw"
        fi

Finally, search for the line that starts with:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-listen

and add "$custom_option" into the line like below:

PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb $custom_option --api-listen


Enjoy...


I'm having a hard time getting this to work.  I followed giletto's instructions, and did end up getting balance mining to work between multiple mining pools but I would like to have the increased control that adding quotas provides.  I have tried leaving the "balance" mod in place while adding n4spd mod...didn't work.  I also removed the "balance" mod and then tried this "quota" mod...again no luck.  Any idea, or does someone have a link to the entire instructions starting from stock?  Thanks in advance for any help provided.
sr. member
Activity: 812
Merit: 250
If the miner can access to the pool again, you don't have to do anything, the miner will simple start mining again, without reboot.
legendary
Activity: 3500
Merit: 6320
Crypto Swap Exchange
Thank you for posting this guide. Saved me a lot of time digging around.   Grin

Quick question. If one of the pools drops off the net for a bit, how long till it recovers if at all? One of my pools is listed as dead, I know it's up because it is working fine with other mining equipment. Will it come back on it's own or do I have to reboot?

Thanks,
Dave
newbie
Activity: 6
Merit: 0
hi, I'm doing wrong? walk into the console, changing the line, and I can not save HELP!
newbie
Activity: 11
Merit: 0
Here's a mod to "/etc/init.d/cgminer" which will allow you to turn on/off load balance with quota using the web interface while still allowing default failover mode.

With this mod, you can still use the web interface to configure the mining pool as normal, using the default failover mode.

However, if enter in quota information for pool1 using web interface, like "65;stratum.mining.eligius.st:3334", then restart will automatically switch to load balance mode.  Note: you need to enter quota info for pool2 or pool3 if not blank.  For example:
65;stratum.mining.eligius.st:3334
35;pool2.xxx.com:3333
0;pool3.xxx.com:3333

In the above case, pool3 will only be used as failover.

To make the change, vi /etc/init.d/cgminer and search for:

        if [ "$_pool1url" != "" -a "$_pool1user" != "" -a "$_pool1pw" != "" ]; t
            POOL1="-o $_pool1url -O $_pool1user:$_pool1pw"
        fi
        if [ "$_pool2url" != "" -a "$_pool2user" != "" -a "$_pool2pw" != "" ]; t
            POOL2="-o $_pool2url -O $_pool2user:$_pool2pw"
        fi
        if [ "$_pool3url" != "" -a "$_pool3user" != "" -a "$_pool3pw" != "" ]; t
            POOL3="-o $_pool3url -O $_pool3user:$_pool3pw"
        fi

Replace it with:

# RMC switch to load balance if quota is found on pool1
pool_switch="-o"
custom_option=
test_load_balance=`expr index "$_pool1url" ";"`
if [ "$test_load_balance" != 0 ]; then
   pool_switch="-U"
   custom_option="--load-balance"
fi

        if [ "$_pool1url" != "" -a "$_pool1user" != "" -a "$_pool1pw" != "" ]; t
            POOL1="$pool_switch $_pool1url -O $_pool1user:$_pool1pw"
        fi
        if [ "$_pool2url" != "" -a "$_pool2user" != "" -a "$_pool2pw" != "" ]; t
            POOL2="$pool_switch $_pool2url -O $_pool2user:$_pool2pw"
        fi
        if [ "$_pool3url" != "" -a "$_pool3user" != "" -a "$_pool3pw" != "" ]; t
            POOL3="$pool_switch $_pool3url -O $_pool3user:$_pool3pw"
        fi

Finally, search for the line that starts with:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-listen

and add "$custom_option" into the line like below:

PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb $custom_option --api-listen


Enjoy...
sr. member
Activity: 386
Merit: 250

Thank you giletto and BotwinBG.   I was reading the cgminer --help options and was looking into doing this but a search found this post and combining both of your information; I now have a working load-balance pool strategy  53% and 47%  for Pool1 and Pool 2, respectively, and Pool3 is 0% absolute failover (only).

[To be honest; I was going to do a crontab shell script to change the /etc/config/cgminer file every 2 hours.  Good thing I found out cgminer supports a multi-pool strategy, lol.]

sr. member
Activity: 812
Merit: 250
Can you update how to balance mining using the latest firmware. It happens that I did not get the line
Code:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-allow $_aa --api-

But

Code:
#PARAMS=" --lowmem $AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-allow $_aa --api-listen"
Code:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-listen --api-network"
You found the right line, the line with the pools and $_pb, even if some commands changed, the line is still the same. Wink
newbie
Activity: 38
Merit: 0
Can you update how to balance mining using the latest firmware. It happens that I did not get the line
Code:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-allow $_aa --api-

But

Code:
#PARAMS=" --lowmem $AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-allow $_aa --api-listen"
Code:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-listen --api-network"
hero member
Activity: 529
Merit: 501
Cool thank you !
sr. member
Activity: 588
Merit: 250
Check out the link I posted above by Meni Rosenfeld. You lower your variance.
sr. member
Activity: 812
Merit: 250
I read it, understand it, but don't get the point where is the advantage to equally load-balance?

If i have 1Th/s and share in balance over 3 pool, each pool get 333Gh/s, right?

Why to add this command to share with quota depend on the pool size? I mean right now, if i use load-balance and i see my 1Th/s share over 1 day almost exactly over all 3 pools. So what happen with quota? I guess my mining power will not increase, so what is the exactly advance in the quota example?
sr. member
Activity: 588
Merit: 250
Ah i got the point. Sorry mate, i can't help you how to do. I guess the syntax should be similar, my advice is, just try? If you got it, please post here. I am sure you must change in the first file, /etc/config/cgminer

Seems quite easy actually.

in /etc/config/cgminer

Code:
option pool1url '35;stratum.mining.eligius.st:3334'
        option pool2url '65;eu-stratum.btcguild.com:3333'

the example above will mine 35% on eligius and 65% on btcguild

then in /etc/init.d/cgminer , in addition to your changes , find

Code:
 POOL1="-o $_pool1url -O $_pool1user:$_pool1pw"

change to
Code:
 POOL1="-U $_pool1url -O $_pool1user:$_pool1pw"
, so change -o to -U.

Repeat for POOL2 and POOL3 .

The interest to play around with quotas came from this post - https://bitcointalksearch.org/topic/mine-in-multiple-pools-to-reduce-variance-78031 .
sr. member
Activity: 812
Merit: 250
Ah i got the point. Sorry mate, i can't help you how to do. I guess the syntax should be similar, my advice is, just try? If you got it, please post here. I am sure you must change in the first file, /etc/config/cgminer
sr. member
Activity: 588
Merit: 250
Oh...alright , this :

Code:
QUOTAS

The load-balance multipool strategy works off a quota based scheduler. The
quotas handed out by default are equal, but the user is allowed to specify any
arbitrary ratio of quotas. For example, if all the quota values add up to 100,
each quota value will be a percentage, but if 2 pools are specified and pool0
is given a quota of 1 and pool1 is given a quota of 9, pool0 will get 10% of
the work and pool1 will get 90%. Quotas can be changed on the fly by the API,
and do not act retrospectively. Setting a quota to zero will effectively
disable that pool unless all other pools are disabled or dead. In that
scenario, load-balance falls back to regular failover priority-based strategy.
While a pool is dead, it loses its quota and no attempt is made to catch up
when it comes back to life.

To specify quotas on the command line, pools should be specified with a
semicolon separated --quota(or -U) entry instead of --url. Pools specified with
--url are given a nominal quota value of 1 and entries can be mixed.

For example:
--url poola:porta -u usernamea -p passa --quota "2;poolb:portb" -u usernameb -p passb
Will give poola 1/3 of the work and poolb 2/3 of the work.

Writing configuration files with quotas is likewise supported. To use the above
quotas in a configuration file they would be specified thus:

"pools" : [
        {
                "url" : "poola:porta",
                "user" : "usernamea",
                "pass" : "passa"
        },
        {
                "quota" : "2;poolb:portb",
                "user" : "usernameb",
                "pass" : "passb"
        }
]
sr. member
Activity: 812
Merit: 250
Why you not use the description as i wrote above? This will load-balance!
sr. member
Activity: 588
Merit: 250
I mean the quotas for the load-balance as described here https://raw.github.com/ckolivas/cgminer/master/README.
sr. member
Activity: 812
Merit: 250
What you mean with quotas?
sr. member
Activity: 588
Merit: 250
How can I add quotas?
sr. member
Activity: 812
Merit: 250
Ok guys, i guess everybody know that sometime a pool with no luck have blocks with a above-average calculation time? Instead of waiting at one pool to finish this block (and lose much time=money) and instead of change the pool manual you can balance mining.

Balance Mining mean, that you can share your miner power with 3 pools (or even 2 pools if you don't want 3).

How to setup:

First setup your pool data in the miner configuration (if not already done for backup pools) for your 3 pools which you want to use. The setup is similar to the backup pool setup, but however unlike the backup setting is it not importent, which pool is pool 1, pool 2 or pool 3, so you can chose free.

After you setup your 3 pools (2 are even possible) you press safe & apply.

Next Step:

Start puTTY and start to ssh in your miner. Write your miner ip in host name, press enter. Wait for login, accept the ssh if neccessary at first time login. Login as: root, the password is standard root too, if you don't change your miner setup password, otherwise use your changed password.

Now you should see:
Code:
root@antMiner:~# 

Enter this command:
Code:
vi /etc/config/cgminer
The cgminer setup will appear. Go to the line:
Code:
option more_options '--quiet'
press i, and change the line to:
Code:
option more_options '--quiet --load-balance'
Press the esc button, and enter :wq for write and quit,
Code:
root@antMiner:~#
should appear again.

Next and last step:
Enter
Code:
vi /etc/init.d/cgminer
Another big menu will appear. Scroll down with arrow down and found the line
Code:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb --api-allow $_aa --api-
Important, there are 2 line almost similar, we need to change the line which not begin with #.

Press the i button and change the line to
Code:
PARAMS="$AOPTIONS $POOL1 $POOL2 $POOL3 $_pb $_mo --api-allow $_aa --api-
Press esc button, and :wq for write and quit. Enter reboot.

Well done! Your miner share now your mining power with all pools that you provide above.

Happy mining!




Jump to: