update documentation
[electrum-server.git] / README.leveldb
1 How to run a pruning node with leveldb
2
3 Pruning nodes use a lightweight database to store address histories.
4 Only unspent coins are kept in that database; spent outputs are
5 pruned.
6
7 As of November 2013 all public servers operate this way.
8 Please see HOWTO.md for more detailled information. The following is a 
9 short outline:
10 __________________________________________________________
11 1. Run bitcoind.
12
13 Install version 0.8.5 or higher.
14 There is no need to patch bitcoind anymore.
15 You need to run it with the config option txindex=1 .
16 If you have not previously done so, you may need to reindex the bitcoind blockchain
17
18 Note: Even though Electrum's database uses pruning, you cannot use it
19 with a ultra-pruning bitcoind (forthcoming in 0.9 or later).
20 A full bitcoin node is required in order to know for each address 
21 if it has been used. Pruning occurs only at the level of the Electrum database.
22
23 __________________________________________________________
24
25 2. Install python-leveldb: 
26
27 Starting at Ubuntu 12.10 you can use apt to install leveldb. If you 
28 rather stay on 12.04 LTS you can use the backport and add 
29 "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe"
30 to your sources file. Install the package with: 
31
32 sudo apt-get install python-leveldb
33
34 alternatively build yourself, see
35 http://code.google.com/p/py-leveldb/ 
36 and
37 http://peter-hoffmann.com/2011/installation-leveldb-ubuntu-python.html
38 make sure you have libtool, automake and pkg-config
39
40 __________________________________________________________
41
42 3. edit /etc/electrum.conf : 
43
44 [server]
45 backend = leveldb
46
47 [leveldb]
48 path = /path/to/your/database
49 pruning_limit = 10
50
51 ______________________________________________________________
52
53 4. catch up with the blockchain.
54
55 In order to speed up the initial catch_up phase, it is recommended to
56 locate your database in shared memory:
57
58  path = /run/shm/electrum_db
59
60 Once your server has finished catching up, copy your database to disk
61 and update the path in /etc/electrum.conf
62
63 During the catch_up phase, you can interrupt the server with Ctrl-C;
64 it will safely write the current status in the database and exit.
65
66 _________________________________
67
68 5. enjoy!
69
70 Once the server is synchronized, it will listen to ports, and the
71 normal way to stop it is to use the 'stop' script. This script will
72 wait until the database is closed.
73
74 Other commands are available: 
75
76 ./server info   : view connections
77 ./server load   : view the size of the queue
78
79
80 ______________________
81 Troubleshooting:
82
83 * if your server or bitcoind is killed because is uses too much
84 memory, configure bitcoind to limit the number of connections
85
86 * if you see "Too many open files" errors, you may need to increase
87 your user's File Descriptors limit. For this, see
88 http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
89