【问题标题】:Ethereum geth: out of memory以太坊 geth:内存不足
【发布时间】:2018-11-08 10:52:17
【问题描述】:

我在使用 ethereum 节点 (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

Go 1.11.1 版

Geth 版本 1.8.17-stable-8bbe7207

【问题讨论】:

    标签: memory-leaks out-of-memory ethereum go-ethereum geth


    【解决方案1】:

    我检查了建议: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.更改启动选项:

    $ 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

    上次错误后我的状态:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-16
      • 2021-11-19
      • 1970-01-01
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      • 2019-04-07
      • 2012-07-27
      相关资源
      最近更新 更多