挂载新增加的硬盘
-
输入fdisk -l 可以查看新增加的硬盘
-
创建分区
输入fdisk /dev/vdb,依次输入n,p,1,按确认按钮 ,w,其中n分别表示创建一个新分区,p表示分区类型为主分区,1表示分区编号是1,w表示保存
-
格式化分区
输入mkfs.ext4 /dev/vdb1 (1就是上一步的分区编号) -
将分区挂载到目录下
输入mkdir /data,在根目录创建/data作为此分区的挂载点,输mount /dev/vdb1 /data,将分区挂载到目录下,通过df - h,可以看到挂载成功 -
自动挂载磁盘
vi /etc/fstab
/dev/vdb1 /data ext4 defaults 0 0
下载数据库快照备份
- 查看数据备份列表
https://cn.developers.tron.network/docs/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%BF%AB%E7%85%A7%E5%A4%87%E4%BB%BD
- 在新挂载的磁盘中创建文件夹
mkdir /data/tron
cd /data/tron
- 下载
wget -b http://47.74.159.117/backup20201120/FullNode_output-directory.tgz
- 查看下载进度
tail -f wget-log
安装jdk
[root@iZ2vc56vrtff9ap354pg2jZ ~]# cd /data/
[root@iZ2vc56vrtff9ap354pg2jZ data]# mkdir soft
jdk 版本 jdk-8u161-linux-x64.tar.gz 上传到 /opt/soft目录 解压到 /opt/soft目录
[root@iZ2vc56vrtff9ap354pg2jZ data]# cd soft/
[root@iZ2vc56vrtff9ap354pg2jZ soft]# tar -zxvf jdk-8u161-linux-x64.tar.gz -C /data/soft/
加入到全局变量
[root@iZ2vc56vrtff9ap354pg2jZ soft]# cd /data/soft/jdk1.8.0_161/
[root@iZ2vc56vrtff9ap354pg2jZ jdk1.8.0_161]# pwd
/data/soft/jdk1.8.0_161
[root@iZ2vc56vrtff9ap354pg2jZ jdk1.8.0_161]# sudo vi /etc/profile
#JAVA_HOME
export JAVA_HOME=/data/soft/jdk1.8.0_161
export PATH=$PATH:$JAVA_HOME/bin
:wq
[root@iZ2vc56vrtff9ap354pg2jZ jdk1.8.0_161]# source /etc/profile
[root@iZ2vc56vrtff9ap354pg2jZ jdk1.8.0_161]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
jdk 安装成功
安装git
- 下载最新git
wget https://github.com/git/git/archive/v2.29.2.tar.gz
- 解压
tar -zxvf v2.29.2.tar.gz
- 进入目录
cd git-2.29.2/
- 安装编译所需要的依赖
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
- 编译git源码
make prefix=/data/soft/git all
- 安装git至/data/soft/git路径
make prefix=/data/soft/git install
- 配置环境变量
vi /etc/profile
- 在底部加上
export PATH=$PATH:/data/soft/git/bin
( 输入 :wq! 保存修改)
- 刷新环境变量
source /etc/profile
- 查看Git是否安装完成
git --version
编译 java-tron源代码
- 创建代码目录
mkdir -p /data/java-tron/
- 下载eventplugin源码
cd /data/java-tron/
git clone https://github.com/tronprotocol/java-tron.git
- 编译java-tron项目
cd java-tron/
./gradlew build
- 查看编译好的jar包
cd /build/libs/
编译eventplugin源代码
- 创建代码目录
mkdir -p /data/eventplugin/
- 下载eventplugin源码
cd /data/eventplugin/
git clone https://github.com/tronprotocol/event-plugin.git
- 编译eventplugin项目
cd event-plugin/
./gradlew build
- 查看编译好的jar包
cd /build/plugins
部署MongoDB
- 下载
cd /data/soft
curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.4.tgz
- 解压
tar zxvf mongodb-linux-x86_64-4.0.4.tgz
mv mongodb-linux-x86_64-4.0.4 mongodb
- 设置环境变量
vi /etc/profile
- 加入到最后
export MONGOPATH=/data/soft/mongodb/
export PATH=$PATH:$MONGOPATH/bin
- 刷新环境变量
source /etc/profile
- 检查是否安装成功
mongod --version
- mongodb配置
mkdir -p /data/soft/mongodb/{log,data}
cd /data/soft/mongodb/log/ && touch mongodb.log && cd ..
vim mgdb.conf
mgdb.conf
dbpath=/data/soft/mongodb/data
logpath=/data/soft/mongodb/log/mongodb.log
port=27017
logappend=true
fork=true
bind_ip=0.0.0.0
auth=true
wiredTigerCacheSizeGB=2
- 启动mongodb
mongod --config ./mgdb.conf &
- 创建管理员命令
mongo
use admin
db.createUser({user:"root",pwd:"hVvTb8ZHKnO3r555",roles:[{role:"root",db:"admin"}]})
- 创建db eventlog和账户命令
db.auth("root", "hVvTb8ZHKnO3r555")
use eventlog
db.createUser({user:"tron",pwd:"dU4lponom6xtzMKl",roles:[{role:"dbOwner",db:"eventlog"}]})
启动
- 解压数据库快照备份
cp /data/tron/
tar -zxvf FullNode_output-directory.tgz ./
- 复制FullNode.jar
cp /data/java-tron/java-tron/build/libs/FullNode.jar ./
- 复制plugin-mongodb-1.0.0.zip
cp /data/eventplugin/event-plugin/build/plugins/plugin-mongodb-1.0.0.zip ./
- 启动
nohup java -Xmx15g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar -c config.conf --es &
- 查看日志文件
tail -f logs/tron.log
配置文件
net {
type = mainnet
# type = testnet
}
storage {
# Directory for storing persistent data
db.version = 2,
db.engine = "LEVELDB",
db.sync = false,
db.directory = "database",
index.directory = "index",
transHistory.switch = "on",
# You can custom these 14 databases' configs:
# account, account-index, asset-issue, block, block-index,
# block_KDB, peers, properties, recent-block, trans,
# utxo, votes, witness, witness_schedule.
# Otherwise, db configs will remain defualt and data will be stored in
# the path of "output-directory" or which is set by "-d" ("--output-directory").
# Attention: name is a required field that must be set !!!
properties = [
// {
// name = "account",
// path = "storage_directory_test",
// createIfMissing = true,
// paranoidChecks = true,
// verifyChecksums = true,
// compressionType = 1, // compressed with snappy
// blockSize = 4096, // 4 KB = 4 * 1024 B
// writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
// cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
// maxOpenFiles = 100
// },
// {
// name = "account-index",
// path = "storage_directory_test",
// createIfMissing = true,
// paranoidChecks = true,
// verifyChecksums = true,
// compressionType = 1, // compressed with snappy
// blockSize = 4096, // 4 KB = 4 * 1024 B
// writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
// cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
// maxOpenFiles = 100
// },
]
needToUpdateAsset = true
//dbsettings is needed when using rocksdb as the storage implement (db.version=2 and db.engine="ROCKSDB").
//we'd strongly recommend that do not modify it unless you know every item's meaning clearly.
dbSettings = {
levelNumber = 7
//compactThreads = 32
blocksize = 64 // n * KB
maxBytesForLevelBase = 256 // n * MB
maxBytesForLevelMultiplier = 10
level0FileNumCompactionTrigger = 4
targetFileSizeBase = 256 // n * MB
targetFileSizeMultiplier = 1
}
//backup settings when using rocks db as the storage implement (db.version=2 and db.engine="ROCKSDB").
//if you want to use the backup plugin, please confirm set the db.version=2 and db.engine="ROCKSDB" above.
backup = {
enable = false // indicate whether enable the backup plugin
propPath = "prop.properties" // record which bak directory is valid
bak1path = "bak1/database" // you must set two backup directories to prevent application halt unexpected(e.g. kill -9).
bak2path = "bak2/database"
frequency = 10000 // indicate backup db once every 10000 blocks processed.
}
}
node.discovery = {
enable = true
persist = true
bind.ip = ""
external.ip = null
}
node.backup {
# my priority, each member should use different priority
priority = 8
# udp listen port, each member should have the save configuration
port = 10001
# time interval to send keepAlive message, each member should have the save configuration
keepAliveInterval = 3000
# peer's ip list, can't contain mine
members = [
# "ip",
# "ip"
]
}
crypto {
engine = "eckey"
}
node {
# trust node for solidity node
# trustNode = "ip:port"
trustNode = "127.0.0.1:50051"
# expose extension api to public or not
walletExtensionApi = true
listen.port = 18888
connection.timeout = 2
tcpNettyWorkThreadNum = 0
udpNettyWorkThreadNum = 1
# Number of validate sign thread, default availableProcessors / 2
# validateSignThreadNum = 16
connectFactor = 0.3
activeConnectFactor = 0.1
maxActiveNodes = 30
maxActiveNodesWithSameIp = 2
maxHttpConnectNumber = 50
minParticipationRate = 15
# check the peer data transfer ,disconnect factor
disconnectNumberFactor = 0.4
maxConnectNumberFactor = 0.8
receiveTcpMinDataLength = 2048
isOpenFullTcpDisconnect = true
p2p {
version = 11111 # 11111: mainnet; 20180622: testnet
}
active = [
# Active establish connection in any case
# Sample entries:
# "ip:port",
# "ip:port"
]
passive = [
# Passive accept connection in any case
# Sample entries:
# "ip:port",
# "ip:port"
]
fastForward = [
"100.26.245.209:18888",
"15.188.6.125:18888"
]
http {
fullNodeEnable = true
fullNodePort = 8090
solidityEnable = true
solidityPort = 8091
}
rpc {
port = 50051
#solidityPort = 50061
# Number of gRPC thread, default availableProcessors / 2
# thread = 16
# The maximum number of concurrent calls permitted for each incoming connection
# maxConcurrentCallsPerConnection =
# The HTTP/2 flow control window, default 1MB
# flowControlWindow =
# Connection being idle for longer than which will be gracefully terminated
maxConnectionIdleInMillis = 60000
# Connection lasting longer than which will be gracefully terminated
# maxConnectionAgeInMillis =
# The maximum message size allowed to be received on the server, default 4MB
# maxMessageSize =
# The maximum size of header list allowed to be received, default 8192
# maxHeaderListSize =
# Transactions can only be broadcast if the number of effective connections is reached.
minEffectiveConnection = 1
}
# number of solidity thread in the FullNode.
# If accessing solidity rpc and http interface timeout, could increase the number of threads,
# The default value is the number of cpu cores of the machine.
#solidity.threads = 8
# Limits the maximum percentage (default 75%) of producing block interval
# to provide sufficient time to perform other operations e.g. broadcast block
# blockProducedTimeOut = 75
# Limits the maximum number (default 700) of transaction from network layer
# netMaxTrxPerSecond = 700
# open the history query APIs(http&GRPC) when node is a lite fullNode,
# like {getBlockByNum, getBlockByID, getTransactionByID...}.
# default: false.
# note: above APIs may return null even if blocks and transactions actually are on the blockchain
# when opening on a lite fullnode. only open it if the consequences being clearly known
# openHistoryQueryWhenLiteFN = false
}
## rate limiter config
rate.limiter = {
# Every api could be set a specific rate limit strategy. Three strategy are supported:GlobalPreemptibleAdapter、IPQPSRateLimiterAdapte、QpsRateLimiterAdapter
# GlobalPreemptibleAdapter: permit is the number of preemptible resource, every client must apply one resourse
# before do the request and release the resource after got the reponse automaticlly. permit should be a Integer.
# QpsRateLimiterAdapter: qps is the average request count in one second supported by the server, it could be a Double or a Integer.
# IPQPSRateLimiterAdapter: similar to the QpsRateLimiterAdapter, qps could be a Double or a Integer.
# If do not set, the "default strategy" is set.The "default startegy" is based on QpsRateLimiterAdapter, the qps is set as 10000.
#
# Sample entries:
#
http = [
# {
# component = "GetNowBlockServlet",
# strategy = "GlobalPreemptibleAdapter",
# paramString = "permit=1"
# },
# {
# component = "GetAccountServlet",
# strategy = "IPQPSRateLimiterAdapter",
# paramString = "qps=1"
# },
# {
# component = "ListWitnessesServlet",
# strategy = "QpsRateLimiterAdapter",
# paramString = "qps=1"
# }
],
rpc = [
# {
# component = "protocol.Wallet/GetBlockByLatestNum2",
# strategy = "GlobalPreemptibleAdapter",
# paramString = "permit=1"
# },
# {
# component = "protocol.Wallet/GetAccount",
# strategy = "IPQPSRateLimiterAdapter",
# paramString = "qps=1"
# },
# {
# component = "protocol.Wallet/ListWitnesses",
# strategy = "QpsRateLimiterAdapter",
# paramString = "qps=1"
# },
]
}
seed.node = {
# List of the seed nodes
# Seed nodes are stable full nodes
# example:
# ip.list = [
# "ip:port",
# "ip:port"
# ]
ip.list = [
"54.236.37.243:18888",
"52.53.189.99:18888",
"18.196.99.16:18888",
"34.253.187.192:18888",
"52.56.56.149:18888",
"35.180.51.163:18888",
"54.252.224.209:18888",
"18.228.15.36:18888",
"52.15.93.92:18888",
"34.220.77.106:18888",
"13.127.47.162:18888",
"13.124.62.58:18888",
"13.229.128.108:18888",
"35.182.37.246:18888",
"34.200.228.125:18888",
"18.220.232.201:18888",
"13.57.30.186:18888",
"35.165.103.105:18888",
"18.184.238.21:18888",
"34.250.140.143:18888",
"35.176.192.130:18888",
"52.47.197.188:18888",
"52.62.210.100:18888",
"13.231.4.243:18888",
"18.231.76.29:18888",
"35.154.90.144:18888",
"13.125.210.234:18888",
"13.250.40.82:18888",
"35.183.101.48:18888"
]
}
genesis.block = {
# Reserve balance
assets = [
{
accountName = "Zion"
accountType = "AssetIssue"
address = "TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm"
balance = "99000000000000000"
},
{
accountName = "Sun"
accountType = "AssetIssue"
address = "TXmVpin5vq5gdZsciyyjdZgKRUju4st1wM"
balance = "0"
},
{
accountName = "Blackhole"
accountType = "AssetIssue"
address = "TLsV52sRDL79HXGGm9yzwKibb6BeruhUzy"
balance = "-9223372036854775808"
}
]
witnesses = [
{
address: THKJYuUmMKKARNf7s2VT51g5uPY6KEqnat,
url = "http://GR1.com",
voteCount = 100000026
},
{
address: TVDmPWGYxgi5DNeW8hXrzrhY8Y6zgxPNg4,
url = "http://GR2.com",
voteCount = 100000025
},
{
address: TWKZN1JJPFydd5rMgMCV5aZTSiwmoksSZv,
url = "http://GR3.com",
voteCount = 100000024
},
{
address: TDarXEG2rAD57oa7JTK785Yb2Et32UzY32,
url = "http://GR4.com",
voteCount = 100000023
},
{
address: TAmFfS4Tmm8yKeoqZN8x51ASwdQBdnVizt,
url = "http://GR5.com",
voteCount = 100000022
},
{
address: TK6V5Pw2UWQWpySnZyCDZaAvu1y48oRgXN,
url = "http://GR6.com",
voteCount = 100000021
},
{
address: TGqFJPFiEqdZx52ZR4QcKHz4Zr3QXA24VL,
url = "http://GR7.com",
voteCount = 100000020
},
{
address: TC1ZCj9Ne3j5v3TLx5ZCDLD55MU9g3XqQW,
url = "http://GR8.com",
voteCount = 100000019
},
{
address: TWm3id3mrQ42guf7c4oVpYExyTYnEGy3JL,
url = "http://GR9.com",
voteCount = 100000018
},
{
address: TCvwc3FV3ssq2rD82rMmjhT4PVXYTsFcKV,
url = "http://GR10.com",
voteCount = 100000017
},
{
address: TFuC2Qge4GxA2U9abKxk1pw3YZvGM5XRir,
url = "http://GR11.com",
voteCount = 100000016
},
{
address: TNGoca1VHC6Y5Jd2B1VFpFEhizVk92Rz85,
url = "http://GR12.com",
voteCount = 100000015
},
{
address: TLCjmH6SqGK8twZ9XrBDWpBbfyvEXihhNS,
url = "http://GR13.com",
voteCount = 100000014
},
{
address: TEEzguTtCihbRPfjf1CvW8Euxz1kKuvtR9,
url = "http://GR14.com",
voteCount = 100000013
},
{
address: TZHvwiw9cehbMxrtTbmAexm9oPo4eFFvLS,
url = "http://GR15.com",
voteCount = 100000012
},
{
address: TGK6iAKgBmHeQyp5hn3imB71EDnFPkXiPR,
url = "http://GR16.com",
voteCount = 100000011
},
{
address: TLaqfGrxZ3dykAFps7M2B4gETTX1yixPgN,
url = "http://GR17.com",
voteCount = 100000010
},
{
address: TX3ZceVew6yLC5hWTXnjrUFtiFfUDGKGty,
url = "http://GR18.com",
voteCount = 100000009
},
{
address: TYednHaV9zXpnPchSywVpnseQxY9Pxw4do,
url = "http://GR19.com",
voteCount = 100000008
},
{
address: TCf5cqLffPccEY7hcsabiFnMfdipfyryvr,
url = "http://GR20.com",
voteCount = 100000007
},
{
address: TAa14iLEKPAetX49mzaxZmH6saRxcX7dT5,
url = "http://GR21.com",
voteCount = 100000006
},
{
address: TBYsHxDmFaRmfCF3jZNmgeJE8sDnTNKHbz,
url = "http://GR22.com",
voteCount = 100000005
},
{
address: TEVAq8dmSQyTYK7uP1ZnZpa6MBVR83GsV6,
url = "http://GR23.com",
voteCount = 100000004
},
{
address: TRKJzrZxN34YyB8aBqqPDt7g4fv6sieemz,
url = "http://GR24.com",
voteCount = 100000003
},
{
address: TRMP6SKeFUt5NtMLzJv8kdpYuHRnEGjGfe,
url = "http://GR25.com",
voteCount = 100000002
},
{
address: TDbNE1VajxjpgM5p7FyGNDASt3UVoFbiD3,
url = "http://GR26.com",
voteCount = 100000001
},
{
address: TLTDZBcPoJ8tZ6TTEeEqEvwYFk2wgotSfD,
url = "http://GR27.com",
voteCount = 100000000
}
]
timestamp = "0" #2017-8-26 12:00:00
parentHash = "0xe58f33f9baf9305dc6f82b9f1934ea8f0ade2defb951258d50167028c780351f"
}
// Optional.The default is empty.
// It is used when the witness account has set the witnessPermission.
// When it is not empty, the localWitnessAccountAddress represents the address of the witness account,
// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account.
// When it is empty,the localwitness is configured with the private key of the witness account.
//localWitnessAccountAddress =
localwitness = [
]
#localwitnesskeystore = [
# "localwitnesskeystore.json"
#]
block = {
needSyncCheck = true
maintenanceTimeInterval = 21600000
proposalExpireTime = 259200000 // 3 day: 259200000(ms)
}
# Transaction reference block, default is "head", configure to "solid" can avoid TaPos error
# trx.reference.block = "head" // head;solid;
# This property sets the number of milliseconds after the creation of the transaction that is expired, default value is 60000.
# trx.expiration.timeInMilliseconds = 60000
vm = {
supportConstant = false
minTimeRatio = 0.0
maxTimeRatio = 5.0
saveInternalTx = false
# In rare cases, transactions that will be within the specified maximum execution time (default 10(ms)) are re-executed and packaged
# longRunningTime = 10
}
committee = {
allowCreationOfContracts = 0 //mainnet:0 (reset by committee),test:1
allowAdaptiveEnergy = 0 //mainnet:0 (reset by committee),test:1
}
event.subscribe = {
path = "/data/test/plugin-mongodb-1.0.0.zip" // absolute path of plugin
server = "127.0.0.1:27017" // target server address to receive event triggers
dbconfig = "eventlog|tron|dU4lponom6xtzMKl" // dbname|username|password
topics = [
{
triggerName = "block" // block trigger, the value can't be modified
enable = false
topic = "block" // plugin topic, the value could be modified
},
{
triggerName = "transaction"
enable = true
topic = "transaction"
},
{
triggerName = "contractevent"
enable = true
topic = "contractevent"
},
{
triggerName = "contractlog"
enable = false
topic = "contractlog"
},
{
triggerName = "solidity" // solidity block event trigger, the value can't be modified
enable = true // the default value is true
topic = "solidity"
},
{
triggerName = "solidityevent"
enable = false
topic = "solidityevent"
},
{
triggerName = "soliditylog"
enable = false
topic = "soliditylog"
}
]
filter = {
fromblock = "" // the value could be "", "earliest" or a specified block number as the beginning of the queried range
toblock = "" // the value could be "", "latest" or a specified block number as end of the queried range
contractAddress = [
"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t" // contract address you want to subscribe, if it's set to "", you will receive contract logs/events with any contract address.
]
contractTopic = [
"" // contract topic you want to subscribe, if it's set to "", you will receive contract logs/events with any contract topic.
]
}
}