> For the complete documentation index, see [llms.txt](https://docker.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docker.shujuwajue.com/webfu-wu-qi-ji-qun/fu-zai-jun-heng-de-gao-ke-yong-fang-an.md).

# 负载均衡的高可用方案

利用Keepalived实现双机热备

![](https://3836016457-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LfnT3088lKmAdd7HarJ%2F-LfnT7osh8cvAGaoM3Y9%2F-LfnTK0a-C1vO9xskvVS%2F1.png?generation=1558862985777951\&alt=media)

进入到nginx容器安装keepalived

```
$ docker exec it n1 bash
$ apt-get update
$ apt-get install keepalived
$ apt-get install vim
```

配置keepalived

网卡配置的是宿主机的网卡
