主题
一、安装环境准备
1.1 jdk 安装
上传 jdk-11.0.17_linux-x64_bin.tar.gz 至 /opt 目录:
bash
tar zxvf jdk-11.0.17_linux-x64_bin.tar.gz1.2 环境变量添加
bash
vim /etc/profilebash
#jdk
export JAVA_HOME=/opt/jdk-11.0.17/
export PATH=$PATH:$JAVA_HOME/bin1.3 获取安装包
企业版 RDS 分为中心节点和服务节点两部分。用户需要在主机上部署以下安装包:
| 安装包名称 | 说明 | 解压后目录名 |
|---|---|---|
| TongRDS-2.2.1.6.MC.tar.gz | 中心节点的安装包 | pcenter |
| TongRDS-2.2.1.6.Node.tar.gz | 服务节点的安装包 | pmemdb |
二、安装中心节点
2.1 安装步骤
获取中心节点安装包,将安装包上传到 Linux 服务器目录下,例如:/home/application。
执行解压命令:
bash
tar zxvf TongRDS-2.2.1.6.MC.tar.gz将 License 授权文件 center.lic 复制到中心节点的 pcenter 目录下。
2.2 修改配置文件
进入配置文件目录:
bash
cd pcenter/etc在配置文件 cluster.properties 中检查并修改为如下配置:
bash
vi cluster.propertiesbash
WebSession.type=register参数说明:
WebSession.type:WebSession 服务对应的类型。
2.3 启停中心节点
前台启动服务:
bash
[xxx@master bin]# ./StartCenter.sh
CenterService start at 6300
SentinelService start at 26379
Center start.
RestServer start at 8086后台启动:
bash
nohup ./StartCenter.sh &停止服务:
bash
[xxx@master bin]# ./StopCenter.sh
stop server: home=/home/xxx/pcenter
The PID of the stopped process is 655
waited 1 seconds
...
process 655 stoped三、安装服务节点
3.1 解压安装包
获取服务节点安装包,将安装包上传到 Linux 服务器目录下,例如:/home/application。
bash
tar zxvf TongRDS-2.2.1.6.Node.tar.gz3.2 修改配置文件
进入配置文件目录并修改配置:
bash
cd pmemdb/etc
vi dynamic.xmlbash
<?xml version="1.0" encoding="UTF-8"?>
<Server>
<Center>
<Password>454d51192b1704c60e19734ce6b38203</Password> # 密码设置
<EndPoint>
<Host>172.24.0.52</Host> # 根据实际 IP 修改
<Port>6300</Port>
</EndPoint>
</Center>参数说明:
Server.Center.Password:连接中心服务使用的密码(缺省配置可不修改)Server.Center.EndPoint.Host:中心节点的主机地址Server.Center.EndPoint.Port:中心节点的服务端口
设置 RDS 密码,编辑 etc/cfg.xml:
bash
vim etc/cfg.xml将 ${Server.Listen.Secure:2} 改为 2,${Server.Listen.RedisPassword:密码} 改为实际密码:
bash
[root@localhost bin]# vim ../etc/cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server>
<Common>
<RuntimeModel>debug</RuntimeModel>
<DataDump>${Server.Common.DataDump:10}</DataDump>
<DataDumpAppending>${Server.Common.DataDumpAppending:false}</DataDumpAppending>
<StartWaiting>${Server.Common.StartWaiting:5}</StartWaiting>
<Service>${Server.Common.Service:WebSession}</Service>
<MaxKeyLength>${Server.Common.MaxKeyLength:1m}</MaxKeyLength>
<MaxValueLength>${Server.Common.MaxValueLength:10m}</MaxValueLength>
</Common>
<Log>
<Level>${Server.Log.Level:error}</Level>
<BackDates>${Server.Log.BackDates:30}</BackDates>
</Log>
<Listen>
<Port>6200</Port>
<Threads>8</Threads>
<MaxConnections>${Server.Listen.MaxConnections:1000}</MaxConnections>
<Backlog>1024</Backlog>
<!-- 0: telnet; 1: SSL; 2: password; 3: SSL + password. default is 1 -->
<Secure>${Server.Listen.Secure:2}</Secure>
<Password>${Server.Listen.Password:537cb0e6b7fbad3b75f2245e61b4d2e4}</Password>
<RedisPort>6379</RedisPort>
<RedisPlainPassword>${Server.Listen.RedisPlainPassword:true}</RedisPlainPassword>
<RedisPassword>${Server.Listen.RedisPassword:mypasswd}</RedisPassword>
</Listen>
<Tables>${Server.Tables:1}</Tables>
<TableTemplate>
<Blocks>${Server.TableTemplate.Blocks:4}</Blocks>
<Rows>${Server.TableTemplate.Rows:0}</Rows>
<Key>bytes2, 100</Key>
<Value>variable, 0</Value>
<Indexes>0</Indexes>
<Sync>
<ListNumbers>${Server.TableTemplate.Sync.ListNumbers:1}</ListNumbers>
<ListLength>${Server.TableTemplate.Sync.ListLength:30000}</ListLength>
</Sync>
</TableTemplate>
</Server>3.3 启停服务节点
在服务节点的 pmemdb/bin 目录下运行:
bash
[xxx@master bin]# ./StartServer.sh
load config-file '/home/xxx/pmemdb/etc/cfg.xml' ok.
Server belonging to 'WebSession' is starting...
Memory cache create ok.
Start listening to port 6200
Start listening to port 6379
Server started.后端启动:
bash
nohup ./StartServer.sh &服务节点在 pmemdb/logs 目录下生成 server.log.xxxxxxxx 日志文件。
停止服务节点:
bash
[xxx@master bin]# ./StopServer.sh
stop server: home=/home/xxx/pmemdb
The PID of the stopped process is 594
...
process 594 stoped四、安装后验证
可以使用自带的 Client.sh -p 6379 进行连接,然后输入 set key value、get key 等命令操作数据。验证操作如下:
bash
cd /home/application/pmemdb/binbash
[root@localhost bin]# ./Client.sh
Command line protocol enabled.
Node connection.
Client is connected to localhost : 6379
localhost:6379 > auth 123
localhost:6379 > -ERR AUTH <password> called without password authentication. Are you sure your configuration is correct?
localhost:6379 > set aaa bbb
localhost:6379 > +OK
localhost:6379 > get aaa
localhost:6379 > $3
localhost:6379 > bbb
localhost:6379 > set ccc 11111111
localhost:6379 > +OK
localhost:6379 > get ccc
localhost:6379 > $8
localhost:6379 > 11111111五、systemd 管理
有启动顺序,请按照 tongrds → tongrds-center → tongrds-server 启动。
bash
cat /etc/systemd/system/tongrds.service << 'EOF'
[Unit]
Description=TongRDS Server
After=network.target
[Service]
Type=forking
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.29.7-1.p01.ky10.aarch64"
ExecStart=/home/application/tong/TongRDS2.2/console/bin/console.sh start
ExecStop=/home/application/tong/TongRDS2.2/console/bin/console.sh stop
PrivateTmp=false
TimeoutSec=0
[Install]
WantedBy=multi-user.target
EOFbash
cat /etc/systemd/system/tongrds-center.service << 'EOF'
[Unit]
Description=TongRDS Center
After=network.target
After=tongrds.service
[Service]
Type=simple
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.29.7-1.p01.ky10.aarch64"
ExecStart=/home/application/tong/TongRDS2.2/console/apps/center/bin/starter.sh start
ExecStop=/home/application/tong/TongRDS2.2/console/apps/center/bin/starter.sh stop
PrivateTmp=false
TimeoutStartSec=60
[Install]
WantedBy=multi-user.target
EOFbash
cat /etc/systemd/system/tongrds-server.service << 'EOF'
[Unit]
Description=TongRDS Server
After=network.target
After=tongrds-center.service
After=tongrds.service
[Service]
Type=simple
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.29.7-1.p01.ky10.aarch64"
ExecStart=/home/application/tong/TongRDS2.2/console/apps/server/bin/starter.sh start
ExecStop=/home/application/tong/TongRDS2.2/console/apps/server/bin/starter.sh stop
PrivateTmp=false
TimeoutStartSec=60
[Install]
WantedBy=multi-user.target
EOF