|
±ÈÀ´Ò»ÏòÑо¿postgresql£¬Ò²Ïë×öÒ»¸öÏñmysqlÒ»ÑùµÄreplication¡£ ¾¿¾¹½á¹ûµ¥Ì¨postgresql²»¹Ü»úÄÜÈôºÎ£¬×ÜÓгŲ»ÏÂÈ¥µÄʱ³½¡£
ÍøÉϲéÁËϹØÓÚpostgresqlµÄһЩ×ÊÁÏ£¬·¢ÏÖpg×Ô¼º²»´øreplicationÕâ¸ö¹¦ÄÜ£¬master-slaveҲûÓУ¬¿ÉÊÇһЩµÚÈý·½µÄÈí¼þ¿ÉÒԳųÖÕâЩ£¬Ò»Â·Í··¢ÏÖslony·Â·ð¿´×Ų»´í£¬¿ÉÊÇÅäÁËÒ»Ìì·¢ÏÖÕâ¸ö¹¤¾ßÉèÖÃ×°±¸°ÚÉèÆäʵÊÇÌ«¸´ÔÓÁË£¬ÐèÒªÊÖ¶¯ÔöÌíÏà¸ÉµÄ¿â£¬½ñºóÔöÌíеÄÒ²±ÈÁ¦Âé·³£¬¶ø¹¦ÄÜÒ²±ÈÁ¦µ¥Ò»¡£
ºóÀ´ÎÊÁËϹ«Ë¾ÀïÀ´×ÔyahooµÄͬÊ£¬·¢ÏÖyahooÊÇÀûÓÃpgpool-IIÀ´ÊµÏֵġ£ÕÒÁËÏÂ×ÊÁÏ·¢ÏÖÕâ¸öÉèÖÃ×°±¸°ÚÉè±ÈÁ¦¼òµ¥£¬¸ù»ùÊǵ¥¸öÉèÖÃ×°±¸°ÚÉèÎļþ±ã¿ÉÒÔŪ¶¨£¬²¢ÇÒÓÐ·ÖÆçµÄconf.sample¹©¸ø³öÀ´£¬ÓÐmaster-slaveµÄconfig sampleºÍreplicationµÄconfig sample.ÈçÐí¾Í½ÚÁ÷ÁËÄêÒ¹Á¿µÄʱºòÁË¡£
˵ϰ²×°½ø³Ì£¬ÈÔÊDZÈÁ¦¼òµ¥¡£ °²×°Ê±³½ÐèÒªÖ¸¶¨Ò»ÏÂpostgresqlµÄ°²×°Â·¾¶±ã¿ÉÒÔÁË£¬ÆäËüûÓÐÌØ´ËÍâ¡£ --with-pgsql=
--with-pgsql-includedir=
--with-pgsql-ibdir=
°²×°Íê³ÉºóÔÚ°²×°Ä¿´ÎµÄetcÏÂÓм¸¸öʵÀýÎļþ¡£ÀïÃæÉêÃ÷µÄÒ²±ÈÁ¦ÇåÎú¡£ÏÂÃæµã´ÜµÄÒ»¸öÊǼàÌý¶Ë¿Ú£¬ÒòΪÎÒ²»Ïë¸Ä·¨Ê½£¬ËùÒÔ¾ÍÈÃpgpoo-IIÖ±½Ó¼àÌý5432¶Ë¿Ú£¬Õâ¸öÒ²ÊÇpostgresqlµÄĬÐí¶Ë¿Ú¡£±ðµÄÒ»¸öÊÇrelication_mode=yes,Õâ¸ö±ØÈ»ÒªÈçÐíÑ¡¡£load_balance_mode = true Õâ¸ö¾ÍËæ±ãÁË£¬Õâ¸ö¾ÍÊǰÑselect²éѯ·ÖÅɵ½2¸ö·ÖÆçµÄ»úеÉÏ¡£ # # pgpool-II configuration file sample # $Header: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample,v 1.26 2009/02/15 05:26:28 t-ishii Exp $
# Host name or IP address to listen on: '*' for all, '' for no TCP/IP # connections listen_addresses = '192.168.100.1'
# Port number for pgpool port = 5432
# Port number for pgpool communication manager pcp_port = 9898
# Unix domain socket path. (The Debian package defaults to # /var/run/postgresql.) socket_dir = '/tmp'
# Unix domain socket path for pgpool communication manager. # (Debian package defaults to /var/run/postgresql) pcp_socket_dir = '/tmp'
# Unix domain socket path for the backend. Debian package defaults to /var/run/postgresql! backend_socket_dir = '/tmp'
# pgpool communication manager timeout. 0 means no timeout,»¥ÁªÍøÐÐÒµµÄ´ÓÒµÈËÔ±ÉúÅÂÄêҹѧ½áÒµ, but strongly not recommended! pcp_timeout = 5
# number of pre-forked child process num_init_children = 32
# Number of connection pools allowed for a child process max_pool = 10
# If idle for this many seconds, child exits. 0 means no timeout. child_life_time = 300
# If idle for this many seconds, connection to PostgreSQL closes. # 0 means no timeout. connection_life_time = 0
# If child_max_connections connections were received, child exits. # 0 means no exit. child_max_connections = 0
# If client_idle_limit is n (n 0), the client is forced to be # disconnected whenever after n seconds idle (even inside an explicit # transactions!) # 0 means no disconnect. client_idle_limit = 0
# Maximum time in seconds to complete client authentication. # 0 means no timeout. authentication_timeout = 10
# Logging directory logdir = '/tmp'
# pid file name pid_file_name = '/tmp/pgpool.pid'
# Replication mode replication_mode = true
# Load balancing mode,Ëæ¼Ç¡£¡£¡£¡£¡£¡£¡£¡£, i.e., all SELECTs are load balanced. # This is ignored if replication_mode is false. load_balance_mode = true
# if there's a data mismatch between master and secondary # start degeneration to stop replication mode replication_stop_on_mismatch = false
# If true, replicate SELECT statement when load balancing is disabled. # If false, it is only sent to the master node. replicate_select = false
# Semicolon separated list of queries to be issued at the end of a session reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT' # for 8.3 or newer PostgreSQL versions DISCARD ALL can be used as # follows. However beware that DISCARD ALL holds exclusive lock on # pg_listener so it will be a serious performance problem if there are # lots of concurrent sessions. # reset_query_list = 'ABORT; DISCARD ALL'
# If true print timestamp on each log line. print_timestamp = true
# If true, operate in master/slave mode. master_slave_mode = false
# If true,ÉµÄºôº°, cache connection pool. connection_cache = true
# Health check timeout. 0 means no timeout. health_check_timeout = 20
# Health check period. 0 means no health check. health_check_period = 0
# Health check user health_check_user = 'nobody'
# Execute command by failover. # special values: %d = node id # %h = host name # %p = port number # %D = database cluster path # %m = new master node id # %M = old master node id # %% = '%' character # failover_command = ''
# Execute command by failback. # special values: %d = node id # %h = host name # %p = port number # %D = database cluster path # %m = new master node id # %M = old master node id # %% = '%' character # failback_command = ''
# If true, automatically locks a table with INSERT statements to keep # SERIAL data consistency. If the data does not have SERIAL data # type, no lock will be issued. An /*INSERT LOCK*/ comment has the
|