栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

2022-03-07 influxdb高可用raft集群读写基本功能校验

2022-03-07 influxdb高可用raft集群读写基本功能校验

目录

摘要:

三节点raft的influxdb集群:

读写数据校验:

查看现有数据库:

在leader的test库中写入数据, 查看follow中是否已经同步:


摘要:

使用raft协议将influxdb组建三节点的raft集群, 1个leader2个follow.

在leader上写, 然后在三个节点上分别读取,测试数据是否正常.

三节点raft的influxdb集群:

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# raftadmin 192.168.58.128:50051 leader
2022/03/07 11:21:07 Invoking Leader()
2022/03/07 11:21:07 Response: address: "192.168.58.128:50051"

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# raftadmin 192.168.58.128:50051 get_configuration
2022/03/07 11:21:07 Invoking GetConfiguration()
2022/03/07 11:21:07 Response: servers: {
  id: "192.168.58.128:50051"
  address: "192.168.58.128:50051"
}
servers: {
  id: "192.168.58.132:50051"
  address: "192.168.58.132:50051"
}
servers: {
  id: "192.168.58.131:50051"
  address: "192.168.58.131:50051"
}

读写数据校验:

查看现有数据库:

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128'  -execute 'show databases'
name: databases
name
----

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.131'  -execute 'show databases'
name: databases
name
----

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.132'  -execute 'show databases'
name: databases
name
----

在leader上创建数据库test, 查看follow是否已经同步创建

----
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128'  -execute 'create database test'
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# 

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128'  -execute 'show databases'
name: databases
name
----
test
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.131'  -execute 'show databases'
name: databases
name
----
test

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.132'  -execute 'show databases'
name: databases
name
----
test

在leader的test库中写入数据, 查看follow中是否已经同步:
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128' -database 'test'   -execute 'insert cpu v=1'
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# 
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# 
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128' -database 'test'   -execute 'insert cpu v=2'
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128' -database 'test'   -execute 'insert cpu v=3'
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# 
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# 
root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.128' -database 'test'   -execute 'select * from cpu'
name: cpu
time                v
----                -
1646624428584348920 1
1646624431790610080 2
1646624434861084775 3

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.131' -database 'test'   -execute 'select * from cpu'
name: cpu
time                v
----                -
1646624428584348920 1
1646624431790610080 2
1646624434861084775 3

root@localhost:~/work/ndb-influxdb-instance/src/influxdb/influxdb-1.8.4# influx -host '192.168.58.132' -database 'test'   -execute 'select * from cpu'
name: cpu
time                v
----                -
1646624428584348920 1
1646624431790610080 2
1646624434861084775 3

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/758592.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号