zato集群部署

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
简介:

  • SQL ODB和Cluster’s config需要首先依次创建,其他三个次序随意
  • 对不熟悉的命令,使用server create *** -h 查看帮助文档
  • 修改完后配置文件,要重启(zato stop ***,  zato start ***)

1. SQL  ODB

  • Create a user for Zato servers
$ sudo su - postgres # OS X users may skip it 
$ createuser --no-superuser --no-createdb --no-createrole zato1 
$ createdb --owner=zato1 zato1 
$ psql --dbname zato1 --command="ALTER ROLE zato1 WITH PASSWORD 'l'"
  • (PostgreSQL only) Create a separate schema for Zato
复制代码
postgres@ubuntu:/home/dimite$ psql
psql (9.3.9)
Type "help" for help.

postgres=# CREATE SCHEMA zato_schema;
CREATE SCHEMA
复制代码
  • Make Zato user the owner of the database created or grant it permissions to issue DDL statements
  • Issue the zato create odb command
zato create odb postgresql --odb_host localhost --odb_port 5432 --odb_user zato1 --odb_db_name zato1 --postgresql_schema zato_schema

删除的话,把create换成delete

  • Revoke any DDL rights given to the Zato user

2. Cluster’s config

zato create cluster --odb_host localhost --odb_port 5432 --odb_user zato1 --odb_db_name zato1 --postgresql_schema zato_schema postgresql localhost 11223 20151 localhost 6379 PROD3 techacc1

3. Web admin

ca

复制代码
zato@ubuntu:~$ zato ca create ca crypto
OK
zato@ubuntu:~$ cd crypto/
zato@ubuntu:~/crypto$ ls
ca-material  out-cert  out-csr  out-priv  out-pub
复制代码

 ca-web-admin

zato@ubuntu:~$ zato ca create web_admin ~/crypto
OK

web-admin

zato create web_admin --odb_host localhost --odb_port 5432 --odb_user zato1 --odb_db_name zato1 --postgresql_schema zato_schema ./web-admin postgresql ~/crypto/out-pub/web-admin-pub-2015-08-21_03-03-28.pem ~/crypto/out-priv/web-admin-priv-2015-08-21_03-03-28.pem ~/crypto/out-cert/web-admin-cert-2015-08-21_03-03-28.pem ~/crypto/ca-material/ca-cert.pem techacc1

建立新用户

zato create user ~/web-admin

4. Load-balancer

ca-lb

zato@ubuntu:~$ zato ca create lb_agent ~/crypto/ zato_lb_agent1
OK

lb

zato create load_balancer ~/load-balancer ~/crypto/out-pub/lb-agent-pub-2015-08-21_03-25-08.pem ~/crypto/out-priv/lb-agent-priv-2015-08-21_03-25-08.pem ~/crypto/out-cert/lb-agent-cert-2015-08-21_03-25-08.pem ~/crypto/ca-material/ca-cert.pem

5. Servers

ca  server

zato@ubuntu:~$ zato ca create server ~/crypto/ PROD3 server_132
OK

create server

zato create server --odb_host localhost --odb_port 5432 --odb_user zato1 --odb_db_name zato1 --postgresql_schema zato_schema ~/server_132 postgresql localhost 6379 ~/crypto/out-pub/PROD3-server_132-pub-2015-08-21_03-42-20.pem ~/crypto/out-priv/PROD3-server_132-priv-2015-08-21_03-42-20.pem ~/crypto/out-cert/PROD3-server_132-cert-2015-08-21_03-42-20.pem ~/crypto/ca-material/ca-cert.pem PROD3 server_132

Start it using the zato start command

zato@ubuntu:~$ zato start web-admin
OK

:每个集群由多个共享同一个SQL和Redis数据库的服务器构成。因此在普通的机子上创建server时,只需要安装zato,再创建server。其中的ODB和redis所在机器的ip和port要根据具体情况写。

把server加入到负载平衡中:位置:Clusters -> (pick one from the table) -> Servers -> Add to LB/Remove from LB/Delete

6. 存在问题

1. server添加到集群后,LB state为Down状态。

这是因为默认配置有问题。打开Clusters -> (pick one from the table) -> Load-balancer,把host和端口改为实际的(查看server中的配置文件:~/server_130/config/repo/server.conf)

2. curl localhost:11223/my_service1 -d '{"cust_id":123, "cust_type":"E"}'可以,但是curl 192.168.174.130:11223/my_service1 -d '{"cust_id":123, "cust_type":"E"}'不可以。

原因:默认配置为127.0.0.1,修改两个地方

2.1 配置文件:~/load-balancer/config/repo中的zato.conf和lb-agent.conf,把其中的127.0.0.1修改为实际的ip

2.2 修改集群的名字:Clusters -> (pick one from the table) -> Edit,把localhost改为实际的ip





本文转自jihite博客园博客,原文链接:http://www.cnblogs.com/kaituorensheng/p/4744813.html,如需转载请自行联系原作者

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
5月前
|
存储 Kubernetes Cloud Native
k8s 集群部署尝试
k8s 集群部署尝试
84 13
|
6月前
|
Kubernetes 负载均衡 应用服务中间件
部署Kubernetes(k8s)多主的高可用集群
在CentOS7上安装Kubernetes多主节点的集群,并且安装calico网络插件和metallb。使用keepalived和haproxy进行负载均衡。最后部署应用
908 0
|
4月前
|
canal Kubernetes Ubuntu
kubespray安装高可用k8s集群
kubespray安装高可用k8s集群
79 0
|
4月前
|
Kubernetes Cloud Native Go
kubekey快速安装高可用k8s集群
kubekey快速安装高可用k8s集群
78 0
|
7月前
|
Kubernetes NoSQL Redis
Kubernetes(k8s)部署高可用多主多从的Redis集群
Kubernetes(k8s)部署高可用多主多从的Redis集群
353 0
|
9月前
|
存储 Kubernetes 网络安全
【k8s 系列】k8s 学习五,k8s 集群部署尝试
【k8s 系列】k8s 学习五,k8s 集群部署尝试
142 0
|
Kubernetes 开发者 容器
K8s 集群部署 | 学习笔记
快速学习 K8s 集群部署
218 0
|
关系型数据库 MySQL Java
集群部署 | 学习笔记
快速学习集群部署。
107 0
集群部署 | 学习笔记
|
负载均衡
集群高可用一
集群与高可用相关介绍
116 0
集群高可用一
|
消息中间件 数据可视化 NoSQL
集群高可用四
集群与高可用相关介绍
161 0
集群高可用四