郭卫东 发表于 昨天 10:28

【三】TDengine 3.3.2 生产级别集群搭建

TDengine 3.3.2 集群搭建

https://i-blog.csdnimg.cn/direct/3d30a411ae6e422f8cffab30e739190a.jpeg
  集群规划

https://i-blog.csdnimg.cn/direct/38f4a9e52170422487e8390a1ed94614.png
一、主机名和端口规划

        修改主机信息:修改hosts信息,TDEngine是通过FQDN进行访问, 规划好三个节点对应的hostname。
        vi /etc/hosts
追加以下信息
192.168.90.131 node1
192.168.90.132 node2
192.168.90.133 node3
修改hostname信息
vi /etc/hostname
根据hosts规划,输入节点名称
node1
验证:查看主机名,如果与hostname配置符合则出现 node1
hostname -f
https://i-blog.csdnimg.cn/direct/e9fbc27fe7bf49a796ffc58bbaf75680.png
开放防火墙6030~6041端口号,确保三个节点间的端口可以相互访问
https://i-blog.csdnimg.cn/direct/969dc443f46e41b5872f972cebd9f2be.png

二、安装TDengine

        下载压缩包:从使用安装包立刻开始 | TDengine 文档 | 涛思数据 获取安装包,选择操纵体系以及对应架构,下载压缩包,
解压压缩包
tar -zxvf  TDengine-server-3.3.2.0-Linux-x64.tar.gz
安装
cd TDengine-server-3.1.1.0/
./install.sh
安装过程会提示如下信息,如果是第一个节点/单机摆设,直接回车创建一个集群;如果是后续节点,输入主节点的hostname:port
https://i-blog.csdnimg.cn/direct/bacc761f9a1c4c23917cb1116538c1ea.png
启动TDengine服务,并查看状态
systemctl start taosd
systemctl status taosd
https://i-blog.csdnimg.cn/direct/138a4ba9712241a7b853bbbf7b61ee4a.png
进入taos命令行
taos
https://i-blog.csdnimg.cn/direct/afa6928835d14cbda6efa60e66d45d06.png
输入 quit 退出命令行

[*]配置集群
编辑配置文件
vi /etc/taos/taos.cfg
修改以下内容// firstEp 是每个数据节点首次启动后连接的第一个数据节点
firstEp               node4:6030
secondEp              node2:6030
// 必须配置为本数据节点的 FQDN,如果本机只有一个 hostname,可解释掉本项
fqdn                  node1
// 配置本数据节点的端口号,缺省是 6030
serverPort            6030
其他的 可选配置
# All data files are stored in this directory, if you are using Windows platform please change to Windows path
dataDir                   /data/taos

#numberofthreads per CPU core
numOfThreadsPerCore 2.0
#numberofthreads to commit cache data
numOfCommitThreads 40
#theproportionof total CPU cores available for query processing
#2.0:thequerythreads will be set to double of the CPU cores.
#1.0:allCPUcores are available for query processing .
#0.5:onlyhalfof the CPU cores are available for query.
#0.0:onlyonecore available.
ratioOfQueryCores  2.0
#thelast_row/first/lastaggregator will not change the original columnname in the result fields
keepColumnName  1
#numberofmanagement nodes in the system
numOfMnodes  2
#enable/disableloadbalancing
balance  0
#numberofseconds allowed for ad node to be offline, for cluster only
offlineThreshold  86400
#maxnumberof v groups per db, 0 means configured automatically
maxVgroupsPerDb 30
#numberofcache blocks per vnode
blocks  60
#thenumberof acknowledgments required for successful data writing
quorum  2
#max length of an SQL
maxSQLLength  1048576
#system timezone
timezone  Asia/Shanghai(CST, +0800)
#system locale
locale enUS.UTF-8
# default system charset
charset UTF-8
# max number of connections allowed in dnode
maxShellConns  50000
# max number of connections allowed in client
maxConnections  50000
# enable/disable system monitor
monitor  1
wallevel  1

重启各个节点的TDengine服务
systemctl stop taosd
systemctl start taosd
systemctl status taosd

查看集群中的节点:
show dnodes;
如果节点只有一个主节点,则必要进入命令行,将其他从节点加入集群
taos
create dnode "node2:6030";
create dnode "node3:6030";
show dnodes;
https://i-blog.csdnimg.cn/direct/637590c2e44c4cb39a873a2bd2174254.png
如果其他从节点的status为offline,可能是服务没有启动/服务启动失败/配置文件中fqdn配置错误。

    常见问题

      服务启动失败。碰到服务启动失败,如下图所示
https://i-blog.csdnimg.cn/direct/fb7e66f3c3794eeca82d9187b01e8ba7.png
       输入/usr/bin/taosd 查看失败泉源 
        观察到localEp与/var/bin/taos目录下的配置文件不一致,直接删除原有的配置文件,再次启            动服务。
        rm -rf /var/lib/taos
       服务便能正确启动了。问题在于每次启动集群后,会在/var/bin/taos下生成各个节点的配置             json文件,启动后比对配置,如果不一致,则会启动失败。
       注:因为rmtaos不会删除相干的数据、日志、集群配置,以是每次重新搭建集群后必要手动           删除以下文件
       rm -rf /var/log/taos
       rm -rf /var/bin/taos
       rm -rf /var/lib/taos

    卸载

      如果是tar方式安装的, 卸载 TDengine 命令如下:
      $ rmtaos

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 【三】TDengine 3.3.2 生产级别集群搭建