add ha proxy documentation

This commit is contained in:
Jack Guo 2020-09-16 15:11:41 -04:00
parent 5eae086396
commit f1bd94e6d7
2 changed files with 70 additions and 4 deletions

View File

@ -9,7 +9,7 @@ Please follow [Deploying openLooKeng Manually](./deployment.md) or [Deploying op
## Configuring HA
- Create an ``etc\state-store.properties`` file inside both coordinators and workers installation directories.
- Create an `etc\state-store.properties` file inside both coordinators and workers installation directories.
### State Store Properties
@ -46,5 +46,38 @@ hetu.multiple-coordinator.enabled=true
The above properties are described below:
- hetu.multiple-coordinator.enabled`: Multiple coordinator mode is enabled
- hetu.embedded-state-store.enabled`: Allow this coordinator to use embedded state store
- `hetu.multiple-coordinator.enabled`: Multiple coordinator mode is enabled
- `hetu.embedded-state-store.enabled`: Allow this coordinator to use embedded state store
## HA Cluster behind Reverse Proxy
To achieve the full benefit of HA, clients(ie. openLooKeng CLI, JDBC, etc) are encouraged to _not_ connect to specific coordinators directly. Instead, they should connect to multiple coordinators through some sort of _reverse proxy_, for example through a load balancer, or a Kubernetes service. This allows the client to continue to work even if a specific coordinator is not working as expected.
### Reverse Proxy Requirement
When the connection is made through a reverse proxy, it is required for a given client to connect to the same coordinator during the execution of a query. This is to ensure a constant heartbeat between the client and coordinator while that query is running. This can be achieved by enabling _sticky_ connections, for example, Nginx's `ip_hash`.
### Configure Reverse Proxy Example (Nginx)
Please include configuration below in the Nginx configuration file (ie. `nginx.conf`)
```
http {
... # Your own configuration
upstream backend {
ip_hash;
server <coordinator1_ip>:<coordinator1_port>;
server <coordinator2_ip>:<coordinator2_port>;
server <coordinator3_ip>:<coordinator3_port>;
...
}
server {
... # Your own configuration
location / {
proxy_pass http://backend;
proxy_set_header Host <nginx_ip>:<nginx_port>;
}
}
}
```

View File

@ -45,4 +45,37 @@ hetu.multiple-coordinator.enabled=true
上述属性说明如下:
- `hetu.multiple-coordinator.enabled`:开启了多协调节点模式。
- `hetu.embedded-state-store.enabled`:允许此协调节点使用嵌入式状态存储。
- `hetu.embedded-state-store.enabled`:允许此协调节点使用嵌入式状态存储。
## HA及反向代理
要尽可能的显示HA的优势建议客户端(例如openLooKeng CLI, JDBC等)不直接连接特定的协调节点而是通过反向代理连接多个协调节点例如使用负载平衡器或者Kubernetes服务这样即使某个协调节点无法正常工作客户端也可以继续使用其它的协调节点。
### 反向代理要求
通过反向代理连接时要求客户端在执行语句查询期间连接到同一协调器确保在语句查询运行时客户端和协调器之间保持恒定心跳。这可以通过配置反向代理实现例如Nginx的`ip_hash`。
### 配置反向代理 (Nginx)
请在Nginx配置文件中包含以下配置nginx.conf
```
http {
... # 用户自定义配置
upstream backend {
ip_hash;
server <coordinator1_ip>:<coordinator1_port>;
server <coordinator2_ip>:<coordinator2_port>;
server <coordinator3_ip>:<coordinator3_port>;
...
}
server {
... # 用户自定义配置
location / {
proxy_pass http://backend;
proxy_set_header Host <nginx_ip>:<nginx_port>;
}
}
}
```