以太坊系列 - geth前后端分离的启动

console 是启动geth 控制台,不加该选项,geth启动之后成为一个后台进程不会自动结束

前后端分离的启动

这种方式既可以随时和geth交互,又不影响geth在后台运行,在服务器上非常有必要。

做成服务

vim startgeth_service.sh
nohup /root/geth/geth  --rpc --networkid=39318 --maxpeers=0 --datadir=/root/geth/devChain  --rpccorsdomain "*" --rpcaddr "0.0.0.0" --rpcapi "eth,web3,personal,net,miner,admin"  2>>/root/geth/output.log  &

使用

将启动脚本复制到/etc/init.d目录下,本例将启动脚本命名为gethd

cp startgeth_service.sh /etc/init.d/gethd

chkconfig gethd on 
service gethd start
service gethd stop  (貌似stop没用,不管了,反正一直开着)

然后使用attach命令开启交互界面,用exit退出也不会影响后台进程
./geth attach ipc:./devChain/geth.ipc

往期精彩回顾:
区块链知识系列
密码学系列
零知识证明系列
共识系列
公链调研系列
BTC系列
以太坊系列
EOS系列
Filecoin系列
联盟链系列
Fabric系列
智能合约系列

猜你喜欢

转载自blog.csdn.net/wcc19840827/article/details/128195451