blob: 0c64d5c646bef74b01227f7a28ad55a40129a721 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
## Tomcat failover with Memcached + Memcached Session Manager + Nginx (load blancer)
- Tested on Ansible 1.9.3 for Debian
- Expects hosts: Centos 6.x
This playbook deploys a failover solution for clustered Tomcat using Nginx as load balancer and Memcached + MSM as session manager.
- Nginx: balances the requests by round robin.
- Memcached: stores `sessionid` of tomcat.
- MSM: manages tomcat session.
For more detail about session management, see https://github.com/magro/memcached-session-manager
This playbook also deploys a demo web app (https://github.com/magro/msm-sample-webapp) to test the session management.
## Initial setup of inventory file
```
[lb_servers]
lbserver
[backend_servers]
tomcat_server_1
tomcat_server_2
[memcached_servers]
cached_server1
cached_server2
```
Edit inventory file `hosts` to suit your requirements and run playbook:
```
$ ansible-playbook -i hosts site.yml
```
When finished, open web browser and access to http://nginx_ip/ to start testing.
## Ideas and improvements
- Setup SSL for load balancer.
- HA load balancer.
- Hardening iptables rules.
Pull requests are welcome.
## License
This work is licensed under MIT license.
|