TFS configuration ha and Failover Test

Source: Internet
Author: User
Tags failover nameserver nginx server

After configuring multiple dataservers, you need to consider the single point of failure problem of nameserver. This article will introduce how to implement ha for the nameserver of TFS. It is officially recommended to use heartbeat, but the implementation configuration of heartbeat is much more complicated than keepalive, therefore, keepalive is used to implement ha and Failover of namserver.

 

Environment Introduction:

NS Server 1 --> 192.168.1.225

NS Server 2 --> 192.168.1.226

Ns vip --> 192.168.1.229

Data Server 1 --> 192.168.1.227

Data Server 2 --> 192.168.1.228

Nginx server --> 192.168.1.12


Disable all name servers and data servers of TFS before starting.

# /usr/local/tfs/scripts/tfs  stop_ns nameserver exit SUCCESSFULLY  # /usr/local/tfs/scripts/tfs stop_ds 1-3 dataserver 1 exit SUCCESSFULLY  dataserver 2 exit SUCCESSFULLY  dataserver 3 exit SUCCESSFULLY


I. Configure TFs Name Server

225 server: # grep-V '^ #'/usr/local/TFS/CONF/ns. conf | grep-V '^ $' [public] log_size = clerk = 16 log_level = clerk = 10240 Port = 8w.work_dir =/usr/local/tfsdev_name = eth0thread_count = 4ip_addr = 192.168.1.229 // 229 IP Address: VIP [nameserver] hosts = 300 hosts = 192.168.1.225 | 192.168.1.226group _ mask = 255.255.255.255block _ max_size = 83886080 max_replication = 2min_replication = 2 servers = 3600cluster_id = physical _ = 50max_write_filecount = 16heart_thread_count = 2 bytes = 10repl_max_time = Cost = 15 compact_max_load = Cost = 120build_plan_ratio = Cost = 60000000 bytes = 2 bytes = 5add_primary_block_count = 3block_chunk_num = 32task_percent_sec_size = 200 task_max_queue_size = bytes = 1 # cd/usr/local/# tar-zcvpf TFs. tgz TFs/# SCP TFs. tgz 192.168.1.226:/usr/local/226 server: # cd/usr/local/# tar-zxvpf TFs. tgz


Ii. Configure ha

225 server # cd/usr/local/src/# wget http://www.keepalived.org/software/keepalived-1.2.13.tar.gz# tar-zxvpf keepalived-1.2.13.tar.gz # cd keepalived-1.2.13 #. /configure -- prefix =/usr/local/keepalived # Make & make install # Cat/usr/local/keepalived/etc/keepalived. conf global_defs {router_id tfs_ns} vrrp_script failed {script "killall-0 blocks" interval 2 weight 2} vrrp_instance vi_1 {state master interface eth0 limit 23 priority 101 limit 1 authentication {auth_type limit password_123} virtual_ipaddress {192.168.1.229/24 BRD 192.168.255.255 Dev eth0 label eth0: 0} track_interface {eth1} track_script {chk_nameserver }}# CD/usr/local/# tar-zcvpf keepalived. tgz keepalived/# SCP keepalived. tgz 192.168.1.226:/usr/local/226 server: # cd/usr/local/# tar-zxvpf keepalived. tgz # tar-zxvpf TFs. tgz # Cat/usr/local/keepalived/etc/keepalived. conf global_defs {router_id tfs_ns} vrrp_script failed {script "killall-0 blocks" interval 2 weight 2} vrrp_instance vi_1 {state master interface eth0 limit 23 priority 100 limit 1 authentication {auth_type limit password_123} virtual_ipaddress {192.168.1.229/24 BRD 192.168.255.255 Dev eth0 label eth0: 0} track_interface {eth1} track_script {chk_nameserver }}


3. modify data server configurations

# Grep-2 'vip '/usr/local/TFS/CONF/Ds. conf // The two data servers perform the same modification operation [dataserver] # nameserver ip addr (VIP) ip_addr = 192.168.1.229


4. Start the service

#/Usr/local/TFS/scripts/TFS start_ds 1-3/227,228 servers run #/usr/local/TFS/scripts/TFS start_ns // 225,226 servers respectively run #/usr/local/keepalived/sbin/keepalived-F/usr/local/keepalived/etc/keepalived. conf // on the 225,226 server, the 225 server will become the master node and register VIP # ip

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/39/wKioL1QovgWglJFMAAO7CQEE3u8683.jpg "Title =" image 1.png "alt =" wkiol1qovgwgljfmaao7cqee3u8683.jpg "/>


# tail -f /var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/39/wKioL1QovjjAMHzSAAhX5iB5T5s697.jpg "Title =" image 2.png "alt =" wkiol1qovjjamhzsaahx5ib5t5s697.jpg "/>


226 the server will become a backup node # tail-F/var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/37/wKiom1QovjuB3PuVAAWMIPHLI5I323.jpg "Title =" image 3.png "alt =" wkiom1qovjub3puvaawmiphli5i323.jpg "/>


V. read/write Test

# /usr/local/tfs/bin/ssm -s 192.168.1.229:8108 -i show machine

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/37/wKiom1QovnPwYRIVAAOGvMAWXxc164.jpg "Title =" image 4.png "alt =" wkiom1qovnpwyrivaaogvmawxxc164.jpg "/>


# /usr/local/tfs/bin/tfstool -s 192.168.1.229:8108TFS> put /var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/39/wKioL1Qovr2z1CctABVWCbM2s4E316.jpg "Title =" image 5.png "alt =" wkiol1qovr2z1cctabvwcbm2s4e0000.jpg "/>


The nginx configuration file needs to be slightly modified, pointing to VIP # grep '000000'/usr/local/nginx/CONF/nginx. conf server 192.168.1.229: 8108; # service nginx restart http: // 192.168.1.12: 7500/V1/TFS/t1brxtbyjt1rcvbvdk

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/37/wKiom1QovsDwuiKVAA6qmLAOvPk280.jpg "Title =" image 6.png "alt =" wkiom1qovsdwuikvaa6qmlaovpk280.jpg "/>


6. Failover Test

225 manually disable the name server service # sh/usr/local/TFS/scripts/TFS stop_ns nameserver exit successfully # tail-F/var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/39/wKioL1Qov47zrr-XAAMCV7fG3XY789.jpg "Title =" image 7.png "alt =" wKioL1Qov47zrr-XAAMCV7fG3XY789.jpg "/>


Observe the log of the 226 server and automatically upgrade it to master # tail-F/var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/39/wKioL1Qov7Gj4hnhAAQAmH_vNTw657.jpg "Title =" image 8.png "alt =" wkiol1qov7gj4hnhaaqamh_vntw657.jpg "/>


Re-upload, read test #/usr/local/TFS/bin/tfstool-s 192.168.1.229: 8w.tfs> put/etc/group

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/37/wKiom1Qov7rgrhFSAAyzyb34JK4740.jpg "Title =" image 9.png "alt =" wkiom1qov7rgrhfsaayzyb34jk4740.jpg "/>


Http: // 192.168.1.12: 7500/V1/TFS/t1trxtbyzt1rcvbvdk

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/37/wKiom1Qov9fB17LqAAJ7XH3IFhY892.jpg "Title =" image 10.png "alt =" wkiom1qov9fb17lqaaj7xh3ifhy892.jpg "/>


Restart the name server service on 225 and observe the log output of 225,226 # sh/usr/local/TFS/scripts/TFS start_ns # tail-F/var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/37/wKiom1Qov_yhzJkIAASNbxm9Nes596.jpg "Title =" image 11.png "alt =" wkiom1qov_yhzjkiaasnbxm9nes596.jpg "/>


# tail -f /var/log/messages

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/39/wKioL1QowD7TxPZwAAJPC2ppiCw653.jpg "Title =" image 12.png "alt =" wkiol1qowd7txpzwaajpc2ppicw653.jpg "/>

This article is from the "Bo Yue" blog and will not be reproduced!

TFS configuration ha and Failover Test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.