Few Months ago, i got a job for migrating Zimbra Mail server location from Singapore Datacenter to Jakarta. Of course they have different public ip address. Migrating Zimbra server is running well. But i have a problem for slowly DNS Propagation and then i think i can solve it with a wonderful application, HAProxy.
Topology
How it works?
This is the best way for waiting propagation, i guess. Let me show you how it working :
- HAProxy will be installed and configured on Singapore Server.
- Zimbra Service on Singapore server will be stopped and HAProxy will redirecting Zimbra Service to Jakarta server.
- When DNS propagating, data will be directed to the new server.
- When user still access Singapore server, actually they are accessing Jakarta server.
Configuration
Before you configuring, make sure your zimbra configuration in each server running well.
- Go to old server and Install HAProxy on Old Server (Singapore), in this case i am using ubuntu 14.04 server :
apt-get install haproxy
- Then, Edit
/etc/haproxy/haproxy.cfg
, but make sure you have been backup these file.
cd /etc/haproxy/ mv haproxy.cfg haproxy.cfg.backup vi haproxy.cfg
- Copy this script into
haproxy.cfg
file :
global user haproxy group haproxy daemon defaults log global option dontlognull timeout connect 5000 timeout client 50000 timeout server 50000 listen proxy-cluster bind 0.0.0.0:80 bind 0.0.0.0:389 bind 0.0.0.0:443 bind 0.0.0.0:110 bind 0.0.0.0:143 bind 0.0.0.0:993 bind 0.0.0.0:995 mode tcp balance leastconn server new-server 192.168.75.132 check listen zimbradmin bind 0.0.0.0:7071 mode tcp balance leastconn server new-server 192.168.75.132 check listen port-smtp bind 0.0.0.0:25 bind 0.0.0.0:465 bind 0.0.0.0:587 mode tcp balance leastconn server new-server 192.168.75.132 check listen statistik bind 0.0.0.0:8080 mode http stats enable stats refresh 60s stats uri / stats realm Please Enter\ Username dan Password\ HAProxy\ Statistic stats auth admin:Secret123! errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http
- Save and exit to configuration file and then stop zimbra service on Singapore Server.
root@singapore:~# su - zimbra zimbra@singapore:~$ zmcontrol stop
- Before it, make sure your zimbra service was stopped :
root@singapore:~# nmap localhost Starting Nmap 6.40 ( http://nmap.org ) at 2017-01-12 14:26 WIB Nmap scan report for localhost (127.0.0.1) Host is up (0.0000020s latency). Not shown: 998 closed ports PORT STATE SERVICE 22/tcp open ssh 53/tcp open domain
- And Then, start HAProxy service.
/etc/init.d/haproxy start haproxy -f /etc/haproxy/haproxy.cfg -D
Okay, finally, try to Access your Zimbra Server on Singapore. Although service on Singapore server was stopped but you should be able to access zimbra :-). Try it with accessing webmail or nmap or anything.
root@mail:~# nmap localhost Starting Nmap 6.40 ( http://nmap.org ) at 2017-01-12 14:27 WIB Nmap scan report for localhost (127.0.0.1) Host is up (0.0000010s latency). Not shown: 987 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 53/tcp open domain 80/tcp open http 110/tcp open pop3 143/tcp open imap 389/tcp open ldap 443/tcp open https 465/tcp open smtps 587/tcp open submission 993/tcp open imaps 995/tcp open pop3s 8080/tcp open http-proxy
Feel free to comment if you find any problem about this tutorial. Thank you.
0 Comments