Use HAProxy as MongoDB sharded cluster mongos Load Balancing

Source: Internet
Author: User
Tags install mongodb haproxy

Use HAProxy as MongoDB sharded cluster mongos Load Balancing

MongoDB shard cluster entry mongos does not have a failover mechanism. The official recommendation is to deploy mongos and the application server together. It is inconvenient to deploy multiple mongos instances for multiple application servers. You can also use LVS or HAProxy to implement the failover mechanism for multiple mongos, but be sure to use client affinity, that is, the client Association feature.

Global
Chroot/data/app_platform/haproxy/share/
Log 127.0.0.1 local3 info
Daemon
User haproxy
Group haproxy
Pidfile/var/run/haproxy. pid
Nbproc 1
Stats socket/tmp/haproxy level admin
Stats maxconn 20
Node master_loadbalance1
Description lb1
Maxconn 65536
Nosplice
Spread-checks 3

Ults
Log global
Mode tcp
Option abortonclose
Option allbackups
Option tcpka
Option redispatch
Retries 3
Timeout check 60 s
Timeout connect 600 s
Timeout queue 600 s
Timeout server 600 s
Timeout tarpit 60 s
Timeout client 600 s



Frontend ipvs_pool 0.0.0.0: 28018
Mode tcp
Maxconn 32768
No option dontlognull
Option tcplog
Log global
Option log-separate-errors
Default_backend mongos_pool

Backend mongos_pool
Mode tcp
Balance source
Default-server inter 2 s fastinter 1 s downinter 5S slowstart 60 s rise 2 fall 5 weight 30

Server gintama-xxx-mongos1 192.168.100.74: 28018 check maxconn 2000
Server gintama-xxx-mongos2 192.168.100.75: 28018 check maxconn 2000

Note
Balance source

MongoDB 3.0 official version released and downloaded

CentOS compilation and installation of MongoDB

CentOS compilation and installation of php extensions for MongoDB and mongoDB

CentOS 6 install MongoDB and server configuration using yum

Install MongoDB2.4.3 in Ubuntu 13.04

MongoDB beginners must read (both concepts and practices)

MongoDB Installation Guide for Ubunu 14.04

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

Nagios monitoring MongoDB sharded cluster service practice

Build MongoDB Service Based on CentOS 6.5 Operating System

MongoDB details: click here
MongoDB: click here

This article permanently updates the link address:

Related Article

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.