Install and configure ipvs in linux and use dblink

Source: Internet
Author: User
Tags psql
I haven't written anything for a long time. I have been reading some open-source things. I have posted the installation and configuration of ipvs on linux and the reference for using dblink for readers and their reference in the future. 1. Download the source code: postgresql-9.3.2.tar.gz2, create your scluster group, and user: groupaddjavassuseraddpostgres-dhomepostgres

I haven't written anything for a long time. I have been reading some open-source things. I have posted the installation and configuration of ipvs on linux and the reference for using dblink for readers and their reference in the future. 1. Download the source code: postgresql-9.3.2.tar.gz 2. Create ipvs cluster group and user: groupadd postgres useradd postgres-d/home/postgres

I haven't written anything for a long time. I have been reading some open-source things. Next I will post the installation and configuration of ipvs on linux and the reference for using dblink for readers and their future reference:

1, download source code: postgresql-9.3.2.tar.gz

2. Create the ipvs cluster group and users:

Groupadd postgres

Useradd s-d/home/postgres-g postgres

Mkdir-p/usr/local/pgsql

Mkdir-p/use/local/pgsql/data

Chown-R postgres. postgres/usr/local/pgsql

Passwd ipvs

Su-postgres

Cd

Vi bash_profile

Export PGHOME =/usr/local/pgsql

Export PGDATA =/usr/local/pgsql/data

Export PATH = $ PATH:/usr/local/pgsql/bin

.. Bash_profile

3. Upload the source code file to the database server:

/Usr/local/pgsql/postgresql-9.3.2.tar.gz

Cd/usr/local/pgsql

Tar zxf postgresql-9.3.2.tar.gz

4. Configure and install the database:

Cd/usr/local/plsql/postgresql-9.3.2

Configure

Make

Su-

Make install

5. initialize the database:

/Usr/local/pgsql/bin/initdb-D/usr/local/pgsql/data

6. configuration parameter file:

Cd/usr/local/pgsql/data

Vi postgresql. conf

-- Listener and Port

7. Configure logon security rules:

Vi pg_hba.conf

8. log on to ipvs and change the password:

Psql S postgres

Alter user Login s password 'test ';

9. Configure dblink:

Cd/usr/local/pgsql/postgresql-9.3.2/contrib/dblink

Make

Su

Make install

Psql S postgres

Create extension dblink;

Select * from pg_extension;

10. Create and use dblink

Psql test

Select dblink_connect ('test _ dblink', 'dbname = s host = 192.168.109.10 port = 1921 user = s password = test ');

Select * from dblink ('test _ dblink', 'select c1, c3 from ttt') as t1 (c1 integer, c2 varchar );

Select dblink_disconnect ('test _ dblink ');

Select dblink_get_connections ();

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.