From 2f019ece2e1541eb60e652c7d3551c0dcf30c45e Mon Sep 17 00:00:00 2001 From: "Eagle[TM]" Date: Sat, 7 Jan 2017 22:03:35 +0000 Subject: [PATCH] mark rpcuser / rpcpassword / maxconnections optional; increase open files; add bsdmainutils build dependency --- HOWTO.md | 13 ++++++++----- configure | 8 ++++---- electrum-server | 2 +- electrum.conf.sample | 6 +++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/HOWTO.md b/HOWTO.md index 56581072..524c8853 100644 --- a/HOWTO.md +++ b/HOWTO.md @@ -96,7 +96,7 @@ to your `.bashrc`, `.profile`, or `.bash_profile`, then logout and relogin: We currently recommend bitcoin core 0.13.2 stable. If your package manager does not supply a recent bitcoind or you prefer to compile it yourself, here are some pointers for Ubuntu: - $ sudo apt-get install make g++ python-leveldb libboost-all-dev libssl-dev libdb++-dev pkg-config libevent-dev + $ sudo apt-get install make bsdmainutils g++ python-leveldb libboost-all-dev libssl-dev libdb++-dev pkg-config libevent-dev $ sudo su - bitcoin $ cd ~/src && wget https://bitcoin.org/bin/bitcoin-core-0.13.2/bitcoin-0.13.2.tar.gz $ sha256sum bitcoin-0.13.2.tar.gz | grep 621201189c0409cb17a5073278872dcdcfff1ea147ead6958b55e94416b896d7 @@ -120,7 +120,10 @@ Write this in `bitcoin.conf`: daemon=1 txindex=1 - maxconnections=8 + +rpcuser / rpcpassword options are only needed for non-localhost connections. +you can consider setting maxconnections if you want to reduce bitcoind bandwidth +(as stated above) If you have an existing installation of bitcoind and have not previously set txindex=1 you need to reindex the blockchain by running @@ -283,14 +286,14 @@ If you intend to run the server publicly have a look at README-IRC.md Electrum server currently needs quite a few file handles to use leveldb. It also requires file handles for each connection made to the server. It's good practice to increase the -open files limit to 64k. +open files limit to 128k. The "configure" script will take care of this and ask you to create a user for running electrum-server. If you're using the user `bitcoin` to run electrum and have added it as shown in this document, run the following code to add the limits to your /etc/security/limits.conf: - echo "bitcoin hard nofile 65536" >> /etc/security/limits.conf - echo "bitcoin soft nofile 65536" >> /etc/security/limits.conf + echo "bitcoin hard nofile 131072" >> /etc/security/limits.conf + echo "bitcoin soft nofile 131072" >> /etc/security/limits.conf If you are on Debian > 8.0 Jessie or another distribution based on it, you also need to add these lines in /etc/pam.d/common-session and /etc/pam.d/common-session-noninteractive otherwise the limits in /etc/security/limits.conf will not work: diff --git a/configure b/configure index a5e50a83..39af1e8f 100755 --- a/configure +++ b/configure @@ -47,8 +47,8 @@ fi if [ ! id -u $user >/dev/null 2>&1 ]; then echo "adding user $user" useradd $user - echo "$user hard nofile 65536" >> /etc/security/limits.conf - echo "$user soft nofile 65536" >> /etc/security/limits.conf + echo "$user hard nofile 131072" >> /etc/security/limits.conf + echo "$user soft nofile 131072" >> /etc/security/limits.conf fi @@ -110,13 +110,13 @@ chown $user:$user $logfile bitcoind_user=$(read_config "bitcoind_user") if ! [ "$bitcoind_user" ]; then - read -p "rpcuser (from your bitcoin.conf file): " -r + read -p "rpcuser (from your bitcoin.conf file, leave empty for localhost): " -r write_config "bitcoind_user" $REPLY fi bitcoind_password=$(read_config "bitcoind_password") if ! [ "$bitcoind_password" ]; then - read -p "rpcpassword (from your bitcoin.conf file): " -r + read -p "rpcpassword (from your bitcoin.conf file, leave emtpy for localhost): " -r write_config "bitcoind_password" $REPLY fi diff --git a/electrum-server b/electrum-server index 057b8734..39af2e84 100755 --- a/electrum-server +++ b/electrum-server @@ -57,7 +57,7 @@ case "$1" in fi echo "Starting server as daemon" - cmd="ulimit -n 65536 ; nohup run_electrum_server.py > /dev/null 2>>$logfile &" + cmd="ulimit -n 131072 ; nohup run_electrum_server.py > /dev/null 2>>$logfile &" if [ `id -u` = 0 ] ; then su $user -c "$cmd" else diff --git a/electrum.conf.sample b/electrum.conf.sample index 23c73670..390d621a 100644 --- a/electrum.conf.sample +++ b/electrum.conf.sample @@ -35,6 +35,6 @@ pruning_limit = 100 [bitcoind] bitcoind_host = localhost bitcoind_port = 8332 -# user and password from bitcoin.conf -bitcoind_user = -bitcoind_password = +# user and password from bitcoin.conf (not needed for localhost) +#bitcoind_user = +#bitcoind_password =