以太坊geth:内存不足

问题描述 投票:0回答:1

使用以太坊节点(Geth)时,我经常遇到内存泄漏的问题。我无法理解原因,问题是在一个无限期的时间点产生的。服务器可以工作一周,有时需要一天时间才能破解。我们正在本地网络中发展:“chainId”:15

我的genesis.json

{
"config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
},
"difficulty": "0x400",
"gasLimit": "0x2100000",
"alloc": {
    "7a69b359e86893efa3d9732e4c65ced51567edd0": 
     { "balance": "0x1337000000000000000000" }     
}}

服务器端:4x cpu / 8GB内存/ Ubuntu 18.04 x64

要运行的命令:

geth --rpcapi personal,web3,eth --mine --minerthreads 4 --rpccorsdomain '0.0.0.0:5000' --rpc --networkid 1999 --datadir ./ --rpcvhosts 127.0.0.1 --port 30304 --rpcport 8546 --rpcaddr 0.0.0.0

转到版本1.11.1

Geth版本1.8.17-stable-8bbe7207

memory-leaks out-of-memory ethereum go-ethereum geth
1个回答
0
投票

我查了一下建议:https://github.com/ethereum/go-ethereum/issues/16377#issuecomment-430642197

我可以说它奏效了。我们的服务器已稳定3周。

我的行动:

1.仅允许特定的ip地址到安装节点的服务器上的开放RPC端口:

$ iptables -A INPUT -p tcp --dport [rpc port] -s [ip who is using your node] -j ACCEPT

2.Сhange启动选项:

$ geth --rpcapi personal,web3,eth --mine --minerthreads 2 --rpccorsdomain ['ip who is using your node:port'] --rpc --networkid 1999 --datadir ./ --rpcvhosts 127.0.0.1 --port 30304 --rpcport [rpc port] --rpcaddr [ip server where your node is installed]

3.对于挖掘,我不建议使用所有处理器核心,让服务器轻松呼吸:

--mine --minerthreads 2

4.具有大内存的服务器更昂贵,对于内部网络,你应该足够2GB。使用SWAP文件:

如何开启:https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04

我最后一次错误后的状态:enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.