-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to integrate zookeeper cluster #2
Comments
目前配置zookeeper的方式也是两种,一种是通过传入参数的方式,一种是修改values.yaml中的配置 我这里着重介绍修改values.yaml文件的配置方式 # 在values.yaml文件中的zookeeper配置如下
zookeeper_servers:
enabled: false
session_timeout_ms: "30000"
operation_timeout_ms: "10000"
#root: "/path/to/zookeeper/node"
#identity: "user:password"
config:
- index: ""
host: ""
port: "" 其中接入zookeeper需要配置的参数有以下
假定zookeeper有三台,host分别是 zookeeper_servers:
enabled: true
session_timeout_ms: "30000"
operation_timeout_ms: "10000"
#root: "/path/to/zookeeper/node"
#identity: "user:password"
config:
- index: "1"
host: "zookeeper-1"
port: "2181"
- index: "2"
host: "zookeeper-2"
port: "2181"
- index: "3"
host: "zookeeper-3"
port: "2181" |
很感谢您提供的解决方案。我也试过了这种方式,不过我的问题暂时还没解决。我的所有的服务其实暂时都放在一台服务器上的,所以我的zookeeper集群是通过k8s启动的三个做了持久化的pod,它们其实都是通过通过同样的host和port访问到的,所以我不知道这种情况该如何来解决。 |
把服务搭建在一台机器或多台机器的性质是一样的 在构建Zookeeper的时候,基本上会有两个Service,一个负责均衡,一个负责生成POD网络标识 # 这个用来外部负载均衡
apiVersion: v1
kind: Service
metadata:
name: zookeeper
spec:
ports:
- name: client
port: 2181
protocol: TCP
targetPort: client
- name: follower
port: 2888
protocol: TCP
targetPort: follower
- name: election
port: 3888
protocol: TCP
targetPort: election
selector:
app.kubernetes.io/component: zookeeper
app.kubernetes.io/instance: zookeeper
app.kubernetes.io/name: zookeeper
sessionAffinity: None
type: ClusterIP # 这个负责生成Pods的唯一网络标示
apiVersion: v1
kind: Service
metadata:
name: zookeeper-headless
spec:
clusterIP: None
ports:
- name: client
port: 2181
protocol: TCP
targetPort: client
- name: follower
port: 2888
protocol: TCP
targetPort: follower
- name: election
port: 3888
protocol: TCP
targetPort: election
selector:
app.kubernetes.io/component: zookeeper
app.kubernetes.io/instance: zookeeper
app.kubernetes.io/name: zookeeper
sessionAffinity: None
type: ClusterIP 如果使用的是以上的方式,配置Zookeeper如下: # 只使用负载均衡的Service
zookeeper_servers:
enabled: true
session_timeout_ms: "30000"
operation_timeout_ms: "10000"
#root: "/path/to/zookeeper/node"
#identity: "user:password"
config:
- index: "1"
host: "zookeeper.default.svc.cluster.local"
port: "2181"
# 或者使用POD的唯一网络标识
zookeeper_servers:
enabled: true
session_timeout_ms: "30000"
operation_timeout_ms: "10000"
#root: "/path/to/zookeeper/node"
#identity: "user:password"
config:
- index: "1"
host: "zookeeper-1.zookeeper-headless.default.svc.cluster.local"
port: "2181"
- index: "2"
host: "zookeeper-2.zookeeper-headless.default.svc.cluster.local"
port: "2181"
- index: "3"
host: "zookeeper-3.zookeeper-headless.default.svc.cluster.local"
port: "2181" Kubernetes文档有详细的介绍,多翻阅文档。 |
非常感谢,解决了我的问题。两种方式都尝试过了,都是可行的。仔细看文档后,发现有些东西也有了新的了解。 |
你好,虽然看到了一些关于zookeeper的相关参数,但是不是很清楚如何来设置这些zookeeper的一些参数,想向您请教下。
The text was updated successfully, but these errors were encountered: