本指南介绍如何将Sentinel安装到Ubuntu 14.04 / 16.04中的现有Masternode上。


安装


1.安装先决条件

确保已安装Node v8.xx或更高版本:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential libzmq3-dev

安装PM2:

# 1. Add the PM2 repository signing key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv D1EA2D4C

2. Add the PM2 repository

echo “deb http://apt.pm2.io/ubuntu stable main” | sudo tee /etc/apt/sources.list.d/pm2.list

3. Update list of available packages

sudo apt-get update

4. Install PM2

sudo apt-get install pm2

确保运行的本地GeekCash守护程序至少为1.0.1.2版(1000102)

geekcash-cli getinfo


2.安装Sentinel

克隆Sentinel存储库并安装节点包。

git clone https://github.com/geekcash/node-sentinel.git && cd node-sentinel

安装节点模块

npm i

如果出现这样的错误,请安装以下命令:

sudo apt-get install libboost-all-dev -y
> [email protected] install /root/node-sentinel/node_modules/zmq
> node-gyp rebuild

Traceback (most recent call last):
File “/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py”, line 13, in <module>
import gyp
File “/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py”, line 8, in <module>
import gyp.input
File “/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py”, line 5, in <module>
from compiler.ast import Const
ImportError: No module named compiler.ast
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-127-generic
gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /root/node-sentinel/node_modules/zmq
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-15T07_22_16_232Z-debug.log


3.创建config.js

cp -i config_example.js config.js

获取RPC用户和密码 .geekcash/geekcash.conf

cd …/
cat .geekcash/geekcash.conf


rpcuser=root
rpcpassword=pass
rpcport=6888
listen=1
server=1
daemon=1
logtimestamps=1
maxconnections=64
txindex=1
masternode=1
externalip=x.x.x.x:6889
masternodeprivkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

编辑config.js

cd node-sentinel
nano config.js


version:‘1.2.1’,
coins: [
{
id: ‘MN-01’,
rpc: {
url: ‘http://127.0.0.1:6888/’,
method: ‘POST’,
auth: {
username: ‘root’,
password: ‘pass’
},
}
},
{
id: ‘MN-02’,
rpc: {
url: ‘http://127.0.0.1:6888/’,
method: ‘POST’,
auth: {
username: ‘root’,
password: ‘pass’
},
}
},
// {
// id: ‘MN-03’,
// rpc: {
// url: ‘http://127.0.0.1:6888/’,
// method: ‘POST’,
// auth: {
// username: ‘root’,
// password: ‘pass’
// },
// }
// },

]


4.允许RPC IP

如果为多个masternode运行sentinel,则需要配置rpcallowip以允许sentinel连接到此MN并重新启动GeekCash守护程序。

rpcuser=root
rpcpassword=pass
rpcallowip=[IP of sentinel]
rpcport=6888
listen=1
server=1
daemon=1
logtimestamps=1
maxconnections=64
txindex=1
masternode=1
externalip=8.8.8.8:6889
masternodeprivkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

例如:您的哨兵在IP:9.9.9.9,其他MN配置

rpcuser=root
rpcpassword=pass
rpcallowip=9.9.9.9
rpcport=6888
listen=1
server=1
daemon=1
logtimestamps=1
maxconnections=64
txindex=1
masternode=1
externalip=8.8.8.8:6889
masternodeprivkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


geekcash-cli stop
geekcashd


5.运行应用程序

pm2 start ./app.js --name sentinel

设置启动脚本

//使用您在服务器启动/重新启动时管理的进程重新启动PM2至关重要。要解决此问题,只需运行此命令即可生成活动的启动脚本:
pm2 startup



#geek-cash

1 Likes4.65 GEEK