Cronolog Delete Old Log Files
Posted : admin On 25.12.2019Installing Pgpool-II is very easy.In the directory which you have extracted the source tar ball,execute the following commands.$./configure$ make$ make installconfigure script collects your system informationand use it for the compilation procedure. You can pass commandline arguments to configure script to change the default behavior,such as the installation directory. Pgpool-IIwill be installed to /usr/local directory by default.make command compiles the source code, andmake install will install the executables.You must have write permission on the installation directory.In this tutorial, we will install Pgpool-IIin the default /usr/local directory.
Note: Pgpool-II requires libpqlibrary in PostgreSQL 7.4 or later (version 3 protocol).If the configure script displays the following error message, thelibpq library may not be installed, or it is not of version 3configure: error: libpq is not installed or libpq is oldIf the library is version 3, but the above message is still displayed, yourlibpq library is probably not recognized by the configure script.The configure script searches for libpqlibrary under /usr/local/pgsql. If you have installed thePostgreSQL in a directory other than /usr/local/pgsql, use-with-pgsql, or -with-pgsql-includedirand -with-pgsql-libdir command line options when youexecute configure. Pgpool-II configuration parameters are saved in thepgpool.conf file. The file is in 'parameter = value'per line format. When you install Pgpool-II,pgpool.conf.sample is automatically created.We recommend copying and renaming it to pgpool.conf, and editit as you like.$ cp /usr/local/etc/pgpool.conf.sample /usr/local/etc/pgpool.confPgpool-II only accepts connections from the localhostusing port 9999 by the default.
If you wish to receive conenctions from other hosts,set to '.' .listenaddresses = 'localhost'port = 9999We will use the default parameters in this tutorial. Pgpool-II has an interface for administrativepurpose to retrieve information on database nodes, shutdownPgpool-II, etc. To usePCP commands, user authentication is required.This authentication is different from PostgreSQL's user authentication.A user name and password need to be defined in the pcp.conffile. In the file, a user name and password are listed as a pair on each line,and they are separated by a colon (:). Passwords are encrypted inmd5 hash format.postgres:e8a48653851e508fb27fc5When you install Pgpool-II, pcp.conf.sampleis automatically created. We recommend copying and renaming itto pcp.conf, and edit it.$ cp /usr/local/etc/pcp.conf.sample /usr/local/etc/pcp.confTo encrypt your password into md5 hash format, use the pgmd5command, which is installed as one of Pgpool-II'sexecutables.
Pgmd5 takes text as a command line argument,and displays its md5-hashed text.For example, give 'postgres' as the command line argument,and pgmd5 displays md5-hashed text on its standard output.$ /usr/local/bin/pgmd5 postgrese8a48653851e508fb27fc5PCP commands are executed via network, so the port number must be configuredwith parameter in pgpool.conf file.We will use the default 9898 for in this tutorial.pcpport = 9898. Now, we need to set up backend PostgreSQL servers for Pgpool-II.
These servers can be placed within the same host asPgpool-II, or on separate machines. If you decideto place the servers on the same host, different port numbers must be assignedfor each server.
What Are Windows Log Files
If the servers are placed on separate machines,they must be configured properly so that they can accept networkconnections from Pgpool-II.backendhostname0 = 'localhost'backendport0 = 5432backendweight0 = 1backendhostname1 = 'localhost'backendport1 = 5433backendweight1 = 1backendhostname2 = 'localhost'backendport2 = 5434backendweight2 = 1For, set the node's hostname, port number,and ratio for load balancing. At the end of each parameter string,node ID must be specified by adding positive integers starting with 0 (i.e. To reflect the above changes in pgpool.conf,Pgpool-II must be restarted.Please refer to 'Starting/Stopping Pgpool-II'.After configuring pgpool.conf and restarting thePgpool-II, let's try the actual replicationand see if everything is working.First, we need to create a database to be replicated. We will name it'benchreplication'. This database needs to be createdon all the nodes. Use thecommands throughPgpool-II, and the database will be createdon all the nodes.$ createdb -p 9999 benchreplicationThen, we'll execute with -i option.-i option initializes the database with pre-defined tables and data.$ pgbench -i -p 9999 benchreplicationThe following table is the summary of tables and data, which will be created.
If, on all the nodes, the listed tables anddata are created, replication is working correctly. Data summary Table NameNumber of Rowspgbenchbranches1pgbenchtellers10pgbenchaccounts100000pgbenchhistory0Let's use a simple shell script to check the above on all the nodes.The following script will display the number of rows in pgbenchbranches,pgbenchtellers, pgbenchaccounts, and pgbenchhistory tables on all the nodes (5432, 5433, 5434).$ for port in 5432 5433 5434; do echo $port for tablename in pgbenchbranches pgbenchtellers pgbenchaccounts pgbenchhistory; do echo $tablename psql -c 'SELECT count(.) FROM $tablename' -p $port benchreplication done done.