博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
yugabyte cloud native db 基本试用
阅读量:6075 次
发布时间:2019-06-20

本文共 5724 字,大约阅读时间需要 19 分钟。

备注:

  测试环境使用docker进行安装试用

 

1. 安装

a. Download mkdir ~/yugabyte && cd ~/yugabyte wget https://downloads.yugabyte.com/yb-docker-ctl && chmod +x yb-docker-ctlb. install docker ps && python --verions docker pull yugabytedb/yugabyte
docker pull yugabytedb/yugabyte

2. 创建数据库集群

备注:使用yb-docker-ctl 创建a. create./yb-docker-ctl create操作日志如下:docker run --name yb-master-n1 --privileged -p 7000:7000 --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --replication_factor=3 --master_addresses=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-master-n1:7100Adding node yb-master-n1docker run --name yb-master-n2 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --replication_factor=3 --master_addresses=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-master-n2:7100Adding node yb-master-n2docker run --name yb-master-n3 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --replication_factor=3 --master_addresses=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-master-n3:7100Adding node yb-master-n3docker run --name yb-tserver-n1 --privileged -p 9000:9000 -p 9042:9042 -p 6379:6379 --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/bin/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-tserver-n1:9100 --yb_num_shards_per_tserver=2Adding node yb-tserver-n1docker run --name yb-tserver-n2 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/bin/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-tserver-n2:9100 --yb_num_shards_per_tserver=2Adding node yb-tserver-n2docker run --name yb-tserver-n3 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/bin/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-tserver-n3:9100 --yb_num_shards_per_tserver=2Adding node yb-tserver-n3PID        Type       Node                 URL                       Status          Started At9666       tserver    yb-tserver-n3        http://192.168.16.7:9000  Running         2018-02-11T02:23:04.064743772Z9498       tserver    yb-tserver-n2        http://192.168.16.6:9000  Running         2018-02-11T02:23:03.799704303Z9368       tserver    yb-tserver-n1        http://192.168.16.5:9000  Running         2018-02-11T02:23:03.537778672Z9231       master     yb-master-n3         http://192.168.16.4:9000  Running         2018-02-11T02:23:03.2530083Z9135       master     yb-master-n2         http://192.168.16.3:9000  Running         2018-02-11T02:23:03.003740203Z9053       master     yb-master-n1         http://192.168.16.2:9000  Running         2018-02-11T02:23:02.746672273Z其中 cql service 端口 localhost:9042  redis localhost:6379b. 检测集群状态./yb-docker-ctl statusPID        Type       Node                 URL                       Status          Started At9666       tserver    yb-tserver-n3        http://192.168.16.7:9000  Running         2018-02-11T02:23:04.064743772Z9498       tserver    yb-tserver-n2        http://192.168.16.6:9000  Running         2018-02-11T02:23:03.799704303Z9368       tserver    yb-tserver-n1        http://192.168.16.5:9000  Running         2018-02-11T02:23:03.537778672Z9231       master     yb-master-n3         http://192.168.16.4:9000  Running         2018-02-11T02:23:03.2530083Z9135       master     yb-master-n2         http://192.168.16.3:9000  Running         2018-02-11T02:23:03.003740203Z9053       master     yb-master-n1         http://192.168.16.2:9000  Running         2018-02-11T02:23:02.746672273Z
 

 参考管理界面

admin ui 

 

 

master ui

 

 

 

3. 数据库链接

a. cql I.连接 docker exec -it yb-tserver-n3 /home/yugabyte/bin/cqlshConnected to local cluster at 127.0.0.1:9042.[cqlsh 5.0.1 | Cassandra 3.9-SNAPSHOT | CQL spec 3.4.2 | Native protocol v4]Use HELP for help.cqlsh> describe keyspaces;system_schema  system_auth  systemcqlsh>II. 创建表CREATE KEYSPACE myapp;CREATE TABLE myapp.stock_market (  stock_symbol text,  ts text,  current_price float,  PRIMARY KEY (stock_symbol, ts))III. insert dataINSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('AAPL','2017-10-26 09:00:00',157.41);INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('AAPL','2017-10-26 10:00:00',157);INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('FB','2017-10-26 09:00:00',170.63);INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('FB','2017-10-26 10:00:00',170.1);INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('GOOG','2017-10-26 09:00:00',972.56);INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('GOOG','2017-10-26 10:00:00',971.91);IV. 查询数据SELECT * FROM myapp.stock_market WHERE stock_symbol = 'AAPL'; stock_symbol | ts                  | current_price--------------+---------------------+---------------         AAPL | 2017-10-26 09:00:00 |        157.41         AAPL | 2017-10-26 10:00:00 |           157b. redis  I.连接 docker exec -it yb-tserver-n3 /home/yugabyte/bin/redis-cli II. 操作127.0.0.1:6379>127.0.0.1:6379> set name dalongOK127.0.0.1:6379> get name"dalong"
 
 

创建结果可以从UI界面查看

 

 

4. 类似工具

tidb  cockroachdb  vitess总之,数据库变化越来越大了,同时对于以前需要关注的分库分表,基本上已经不用管理,平台自己处理了,同时我们对于我们只需要关注业务实现官方也提供了kubernetes 的运行配置脚本
 
 

5. 参考资料

https://docs.yugabyte.com/quick-start/create-local-cluster/
 
 
 
 

转载地址:http://oongx.baihongyu.com/

你可能感兴趣的文章
七周五次课(1月26日)
查看>>
Linux系统一些系统查看指令
查看>>
php中的短标签 太坑人了
查看>>
[译] 可维护的 ETL:使管道更容易支持和扩展的技巧
查看>>
### 继承 ###
查看>>
数组扩展方法之求和
查看>>
astah-professional-7_2_0安装
查看>>
函数是对象-有属性有方法
查看>>
uva 10107 - What is the Median?
查看>>
Linux下基本栈溢出攻击【转】
查看>>
c# 连等算式都在做什么
查看>>
使用c:forEach 控制5个换行
查看>>
java web轻量级开发面试教程摘录,java web面试技巧汇总,如何准备Spring MVC方面的面试...
查看>>
根据调试工具看Vue源码之组件通信(一)
查看>>
Thrift RPC 系列教程(5)—— 接口设计篇:struct & enum设计
查看>>
斯坦福-随机图模型-week1.5
查看>>
灵活的运用Model类
查看>>
hadoop 之分布式安装
查看>>
使用ansible工具部署ceph
查看>>
linux系列博文---->深入理解linux启动运行原理(一)
查看>>