[bitnami/zookeeper] add zookeeper peerType,observer (#7065)
add zookeeper peerType,observer Signed-off-by: bimoQi <1303445410@qq.com> Signed-off-by: bimoQi <1303445410@qq.com>
This commit is contained in:
parent
142c756937
commit
877bd70c89
|
|
@ -106,12 +106,12 @@ zookeeper_validate() {
|
|||
read -r -a zookeeper_servers_list <<<"${ZOO_SERVERS//[;, ]/ }"
|
||||
for server in "${zookeeper_servers_list[@]}"; do
|
||||
if is_boolean_yes "$server_id_with_jumps"; then
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+::[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port::id. Example: zookeeper:2888:3888::1"
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+(:observer|:participant)?::[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port::id. Example: zookeeper:2888:3888::1 zookeeper:2888:3888:observer::1"
|
||||
fi
|
||||
else
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port. Example: zookeeper:2888:3888"
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+(:observer|:participant)?$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port. Example: zookeeper:2888:3888 zookeeper:2888:3888:observer"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
@ -120,6 +120,13 @@ zookeeper_validate() {
|
|||
check_multi_value "ZOO_TLS_CLIENT_AUTH" "none want need"
|
||||
check_multi_value "ZOO_TLS_QUORUM_CLIENT_AUTH" "none want need"
|
||||
|
||||
# ZooKeeper server peerType validations
|
||||
if [[ -n "$ZOO_PEER_TYPE" ]]; then
|
||||
if [[ "$ZOO_PEER_TYPE" != "observer" ]] && [[ "$ZOO_PEER_TYPE" != "participant" ]]; then
|
||||
print_validation_error "The ZOO_PEER_TYPE environment ${ZOO_PEER_TYPE} should be one of [observer/participant]"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ "$error_code" -eq 0 ]] || exit "$error_code"
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +172,11 @@ zookeeper_initialize() {
|
|||
else
|
||||
info "Deploying ZooKeeper with persisted data..."
|
||||
fi
|
||||
|
||||
# ZooKeeper set server peerType
|
||||
if [[ -n "$ZOO_PEER_TYPE" ]]; then
|
||||
zookeeper_conf_set "$ZOO_CONF_FILE" peerType "$ZOO_PEER_TYPE"
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ zookeeper_env_vars=(
|
|||
ZOO_SERVERS
|
||||
ZOO_ENABLE_ADMIN_SERVER
|
||||
ZOO_ADMIN_SERVER_PORT_NUMBER
|
||||
ZOO_PEER_TYPE
|
||||
ZOO_TICK_TIME
|
||||
ZOO_INIT_LIMIT
|
||||
ZOO_SYNC_LIMIT
|
||||
|
|
@ -106,6 +107,7 @@ export ZOO_SERVER_ID="${ZOO_SERVER_ID:-1}"
|
|||
export ZOO_SERVERS="${ZOO_SERVERS:-}"
|
||||
export ZOO_ENABLE_ADMIN_SERVER="${ZOO_ENABLE_ADMIN_SERVER:-yes}"
|
||||
export ZOO_ADMIN_SERVER_PORT_NUMBER="${ZOO_ADMIN_SERVER_PORT_NUMBER:-8080}"
|
||||
export ZOO_PEER_TYPE="${ZOO_PEER_TYPE:-}"
|
||||
|
||||
# ZooKeeper settings
|
||||
export ZOO_TICK_TIME="${ZOO_TICK_TIME:-2000}"
|
||||
|
|
|
|||
|
|
@ -106,12 +106,12 @@ zookeeper_validate() {
|
|||
read -r -a zookeeper_servers_list <<<"${ZOO_SERVERS//[;, ]/ }"
|
||||
for server in "${zookeeper_servers_list[@]}"; do
|
||||
if is_boolean_yes "$server_id_with_jumps"; then
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+::[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port::id. Example: zookeeper:2888:3888::1"
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+(:observer|:participant)?::[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port::id. Example: zookeeper:2888:3888::1 zookeeper:2888:3888:observer::1"
|
||||
fi
|
||||
else
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port. Example: zookeeper:2888:3888"
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+(:observer|:participant)?$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port. Example: zookeeper:2888:3888 zookeeper:2888:3888:observer"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
@ -120,6 +120,13 @@ zookeeper_validate() {
|
|||
check_multi_value "ZOO_TLS_CLIENT_AUTH" "none want need"
|
||||
check_multi_value "ZOO_TLS_QUORUM_CLIENT_AUTH" "none want need"
|
||||
|
||||
# ZooKeeper server peerType validations
|
||||
if [[ -n "$ZOO_PEER_TYPE" ]]; then
|
||||
if [[ "$ZOO_PEER_TYPE" != "observer" ]] && [[ "$ZOO_PEER_TYPE" != "participant" ]]; then
|
||||
print_validation_error "The ZOO_PEER_TYPE environment ${ZOO_PEER_TYPE} should be one of [observer/participant]"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ "$error_code" -eq 0 ]] || exit "$error_code"
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +172,11 @@ zookeeper_initialize() {
|
|||
else
|
||||
info "Deploying ZooKeeper with persisted data..."
|
||||
fi
|
||||
|
||||
# ZooKeeper set server peerType
|
||||
if [[ -n "$ZOO_PEER_TYPE" ]]; then
|
||||
zookeeper_conf_set "$ZOO_CONF_FILE" peerType "$ZOO_PEER_TYPE"
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ zookeeper_env_vars=(
|
|||
ZOO_SERVERS
|
||||
ZOO_ENABLE_ADMIN_SERVER
|
||||
ZOO_ADMIN_SERVER_PORT_NUMBER
|
||||
ZOO_PEER_TYPE
|
||||
ZOO_TICK_TIME
|
||||
ZOO_INIT_LIMIT
|
||||
ZOO_SYNC_LIMIT
|
||||
|
|
@ -106,6 +107,7 @@ export ZOO_SERVER_ID="${ZOO_SERVER_ID:-1}"
|
|||
export ZOO_SERVERS="${ZOO_SERVERS:-}"
|
||||
export ZOO_ENABLE_ADMIN_SERVER="${ZOO_ENABLE_ADMIN_SERVER:-yes}"
|
||||
export ZOO_ADMIN_SERVER_PORT_NUMBER="${ZOO_ADMIN_SERVER_PORT_NUMBER:-8080}"
|
||||
export ZOO_PEER_TYPE="${ZOO_PEER_TYPE:-}"
|
||||
|
||||
# ZooKeeper settings
|
||||
export ZOO_TICK_TIME="${ZOO_TICK_TIME:-2000}"
|
||||
|
|
|
|||
|
|
@ -106,12 +106,12 @@ zookeeper_validate() {
|
|||
read -r -a zookeeper_servers_list <<<"${ZOO_SERVERS//[;, ]/ }"
|
||||
for server in "${zookeeper_servers_list[@]}"; do
|
||||
if is_boolean_yes "$server_id_with_jumps"; then
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+::[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port::id. Example: zookeeper:2888:3888::1"
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+(:observer|:participant)?::[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port::id. Example: zookeeper:2888:3888::1 zookeeper:2888:3888:observer::1"
|
||||
fi
|
||||
else
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port. Example: zookeeper:2888:3888"
|
||||
if ! echo "$server" | grep -q -E "^[^[:space:]]+:[[:digit:]]+:[[:digit:]]+(:observer|:participant)?$"; then
|
||||
print_validation_error "Zookeeper server ${server} should follow the next syntax: host:port:port. Example: zookeeper:2888:3888 zookeeper:2888:3888:observer"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
@ -120,6 +120,13 @@ zookeeper_validate() {
|
|||
check_multi_value "ZOO_TLS_CLIENT_AUTH" "none want need"
|
||||
check_multi_value "ZOO_TLS_QUORUM_CLIENT_AUTH" "none want need"
|
||||
|
||||
# ZooKeeper server peerType validations
|
||||
if [[ -n "$ZOO_PEER_TYPE" ]]; then
|
||||
if [[ "$ZOO_PEER_TYPE" != "observer" ]] && [[ "$ZOO_PEER_TYPE" != "participant" ]]; then
|
||||
print_validation_error "The ZOO_PEER_TYPE environment ${ZOO_PEER_TYPE} should be one of [observer/participant]"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ "$error_code" -eq 0 ]] || exit "$error_code"
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +172,11 @@ zookeeper_initialize() {
|
|||
else
|
||||
info "Deploying ZooKeeper with persisted data..."
|
||||
fi
|
||||
|
||||
# ZooKeeper set server peerType
|
||||
if [[ -n "$ZOO_PEER_TYPE" ]]; then
|
||||
zookeeper_conf_set "$ZOO_CONF_FILE" peerType "$ZOO_PEER_TYPE"
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ zookeeper_env_vars=(
|
|||
ZOO_SERVERS
|
||||
ZOO_ENABLE_ADMIN_SERVER
|
||||
ZOO_ADMIN_SERVER_PORT_NUMBER
|
||||
ZOO_PEER_TYPE
|
||||
ZOO_TICK_TIME
|
||||
ZOO_INIT_LIMIT
|
||||
ZOO_SYNC_LIMIT
|
||||
|
|
@ -106,6 +107,7 @@ export ZOO_SERVER_ID="${ZOO_SERVER_ID:-1}"
|
|||
export ZOO_SERVERS="${ZOO_SERVERS:-}"
|
||||
export ZOO_ENABLE_ADMIN_SERVER="${ZOO_ENABLE_ADMIN_SERVER:-yes}"
|
||||
export ZOO_ADMIN_SERVER_PORT_NUMBER="${ZOO_ADMIN_SERVER_PORT_NUMBER:-8080}"
|
||||
export ZOO_PEER_TYPE="${ZOO_PEER_TYPE:-}"
|
||||
|
||||
# ZooKeeper settings
|
||||
export ZOO_TICK_TIME="${ZOO_TICK_TIME:-2000}"
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ The configuration can easily be setup with the Bitnami Apache ZooKeeper Docker i
|
|||
- `ZOO_TLS_QUORUM_CLIENT_AUTH`: Specifies options to authenticate TLS connections from clients. Available values are: `none`, `want`, `need`. Default: **need**
|
||||
- `ZOO_ENABLE_ADMIN_SERVER`: Enable [admin server](https://zookeeper.apache.org/doc/r3.5.7/zookeeperAdmin.html#sc_adminserver). Default: **yes**
|
||||
- `ZOO_ADMIN_SERVER_PORT_NUMBER`: [Admin server](https://zookeeper.apache.org/doc/r3.5.7/zookeeperAdmin.html#sc_adminserver) port. Default: **8080**
|
||||
- `ZOO_PEER_TYPE`: Zookeeper Node [Peer type](https://zookeeper.apache.org/doc/r3.6.3/zookeeperObservers.html). Default: No Defaults
|
||||
|
||||
```console
|
||||
$ docker run --name zookeeper -e ZOO_SERVER_ID=1 bitnami/zookeeper:latest
|
||||
|
|
@ -331,6 +332,8 @@ A Apache ZooKeeper (https://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html)
|
|||
- `ZOO_SERVERS`: Comma, space or semi-colon separated list of servers.This can be done with or without specifying the ID of the server in the ensemble. No defaults. Examples:
|
||||
- without Server ID - zoo1:2888:3888,zoo2:2888:3888
|
||||
- with Server ID - zoo1:2888:3888::1,zoo2:2888:3888::2
|
||||
- without Server ID And Observers - zoo1:2888:3888,zoo2:2888:3888:observer
|
||||
- with Server ID And Observers - zoo1:2888:3888::1,zoo2:2888:3888:observer::2
|
||||
|
||||
For reliable Apache ZooKeeper service, you should deploy Apache ZooKeeper in a cluster known as an ensemble. As long as a majority of the ensemble are up, the service will be available. Because Apache ZooKeeper requires a majority, it is best to use an odd number of machines. For example, with four machines Apache ZooKeeper can only handle the failure of a single machine; if two machines fail, the remaining two machines do not constitute a majority. However, with five machines Apache ZooKeeper can handle the failure of two machines.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue