×ðÁú¿­Ê±

ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿âÊðÀí

ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿âÊðÀí

ͻ񻣼

ÔÚÏÖ´úµÄ»¥ÁªÍøÓ¦ÓóÌÐòÖÐ £¬Êý¾Ý¿âÊdzÐÔØÊý¾ÝµÄÖ÷Òª×é¼þÖ®Ò»¡£ÎªÁËÈ·±£Êý¾Ý¿âµÄ¸ß¿ÉÓÃÐԺͿɿ¿ÐÔ £¬ÉèÖÃÒ»¸ö¸ß¿ÉÓõÄÊý¾Ý¿âÊðÀíÊÇÖÁ¹ØÖ÷ÒªµÄ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿âÊðÀí £¬²¢ÌṩһЩ´úÂëʾÀý¡£

СÐò£º

Ëæ×Å»¥ÁªÍøÓ¦ÓóÌÐòµÄÉú³¤ £¬Êý¾Ý¿â³ÉΪÁË´æ´¢Êý¾ÝµÄÖ÷Òª×é¼þ¡£µ±Êý¾Ý¿â·ºÆð¹ÊÕÏ»ò¸ºÔعý¸ßʱ £¬Õû¸öÓ¦ÓóÌÐòµÄÐÔÄܺͿÉÓÃÐÔ¶¼»áÊܵ½Ó°Ï졣ΪÁËÈ·±£Êý¾Ý¿âµÄ¸ß¿ÉÓÃÐÔ £¬Ðí¶à¹«Ë¾Ñ¡ÔñÉèÖÃÊý¾Ý¿âÊðÀíÀ´ÖÎÀí¶à¸öÊý¾Ý¿âµÄÅþÁ¬ºÍ¹ÊÕÏתÒÆ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿âÊðÀí £¬²¢ÌṩһЩʾÀý´úÂë¡£

°ì·¨1£º×°ÖÃÊý¾Ý¿âÊðÀíÈí¼þ

Ê×ÏÈ £¬ÎÒÃÇÐèҪѡÔñÒ»¸öÊʺϵÄÊý¾Ý¿âÊðÀíÈí¼þ¡£ÔÚLinuxÇéÐÎÏ £¬³£ÓõÄÊý¾Ý¿âÊðÀíÈí¼þÓÐPgBouncer¡¢MaxScaleºÍHAProxy¡£±¾ÎÄÒÔPgBouncerΪÀý¾ÙÐÐÏÈÈÝ¡£

Ê×ÏÈ £¬ÎÒÃÇÐèҪװÖÃPgBouncerÈí¼þ¡£ÔÚUbuntuÉÏ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐ×°Öãº

sudo apt-get install pgbouncer

µÇ¼ºó¸´ÖÆ

°ì·¨2£ºÉèÖÃPgBouncer

×°ÖÃÍê³Éºó £¬ÎÒÃÇÐèÒªÉèÖÃPgBouncerÒÔʵÏָ߿ÉÓÃÐÔ¡£ÉèÖÃÎļþͨ³£Î»ÓÚ/etc/pgbouncer/pgbouncer.ini¡£ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄʾÀýÉèÖÃÎļþ£º

[databases]
mydb = host=your_host port=your_port dbname=your_db user=your_user password=your_password

[pgbouncer]
listen_addr = *
listen_port = 6432
auth_type = trust
auth_file = /etc/pgbouncer/userlist.txt
admin_users = your_admin_user
stats_users = your_stats_user
pool_mode = transaction
server_reset_query = DISCARD ALL

µÇ¼ºó¸´ÖÆ

×¢ÖØ £¬ÄãÐèÒª½«ÉÏÊöµÄyour_host¡¢your_port¡¢your_db¡¢your_user¡¢your_password¡¢your_admin_userºÍyour_stats_userÌ滻ΪÏÖʵµÄÖµ¡£

°ì·¨3£ºÉèÖÃÊý¾Ý¿â»á¼ûȨÏÞ

PgBouncerÐèÒªÒ»¸öÓû§ÁбíÎļþÀ´ÑéÖ¤Óû§ÃûºÍÃÜÂë¡£½¨ÉèÒ»¸öÃûΪuserlist.txtµÄÎļþ £¬²¢½«Óû§ÃûºÍÃÜÂëдÈëÆäÖУº

your_user:your_password

µÇ¼ºó¸´ÖÆ

×¢ÖØ £¬ÄãÐèÒª½«ÉÏÊöµÄyour_userºÍyour_passwordÌ滻ΪÏÖʵµÄÖµ¡£

°ì·¨4£ºÆô¶¯PgBouncer

ÉèÖÃÍê³Éºó £¬Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÆô¶¯PgBouncer£º

pgbouncer -d /etc/pgbouncer/pgbouncer.ini

µÇ¼ºó¸´ÖÆ

°ì·¨5£ºÅþÁ¬µ½Êý¾Ý¿âÊðÀí

ÏÖÔÚ £¬Äã¿ÉÒÔʹÓÃPgBouncer×÷ΪÊý¾Ý¿âµÄÊðÀí¾ÙÐÐÅþÁ¬¡£ÅþÁ¬×Ö·û´®Îª£º

host=your_pgbouncer_host port=your_pgboucner_port dbname=your_db user=your_user password=your_password

µÇ¼ºó¸´ÖÆ

×¢ÖØ £¬ÄãÐèÒª½«ÉÏÊöµÄyour_pgbouncer_host¡¢your_pgboucner_port¡¢your_db¡¢your_userºÍyour_passwordÌ滻ΪÏÖʵµÄÖµ¡£

×ܽ᣺

ÔÚ±¾ÎÄÖÐ £¬ÎÒÃÇÏÈÈÝÁËÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿âÊðÀí £¬²¢ÌṩÁËÒ»¸öʹÓÃPgBouncerµÄʾÀý¡£ÉèÖÃÊý¾Ý¿âÊðÀí¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄ¿ÉÓÃÐÔºÍÐÔÄÜ £¬²¢È·±£Ó¦ÓóÌÐòµÄ˳ËìÔËÐС£Ï£Íû±¾ÎĶÔÄãÓÐËù×ÊÖú£¡

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÊý¾Ý¿âÊðÀíµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿