Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

5.5. 连接控制台

一般测试启动我们使用 console,如果是正式启动无需使用 console。同事我们使用&符号使其进入后台运行。

			
neo@netkiller ~/ethereum % geth --networkid 123456 --rpc --rpcaddr="0.0.0.0" --rpccorsdomain "*" --nodiscover &			
			
		

进入控制台

			
neo@netkiller ~/ethereum % geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.1
coinbase: 0x83fda0ba7e6cfa8d7319d78fa0e6b753a2bcb5a6
at block: 531 (Tue, 14 Nov 2017 17:36:05 HST)
 datadir: /home/neo/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
			
		

退出控制台

			
> exit
			
		

5.5.1. 指定 geth.ipc 文件位置

				
geth --ipcpath ~/.ethereum/geth.ipc attach				
				
			

5.5.2. IPC 方式连接

				
neo@netkiller ~ % geth attach ethereum/data1/geth.ipc 
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.1
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

>				
				
			

5.5.3. TCP 连接控制台

连接远程控制台

				
neo@netkiller ~/ethereum % geth --exec 'eth.coinbase' attach http://172.16.0.10:8545
"0x83fda0ba7e6cfa8d7319d78fa0e6b753a2bcb5a6"
				
			

5.5.4. WebSocket 方式

				
$ geth attach ws://191.168.1.1:8546