RSS

Category Archives: PostgreSQL

Installation missing of php-devel php-mbstring on Redhat 7

Installation missing of php-devel php-mbstring on Redhat 7

# yum install php-devel php-mbstring

No package php-devel available.
No package php-mbstring available.

Solution:-

# subscription-manager repos –enable=rhel-7-server-optional-rpms

[root@mail /]# yum install php-devel php-mbstring
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
Resolving Dependencies
–> Running transaction check
—> Package php-devel.x86_64 0:5.4.16-45.el7 will be installed
–> Processing Dependency: pcre-devel(x86-64) for package: php-devel-5.4.16-45.el7.x86_64
—> Package php-mbstring.x86_64 0:5.4.16-45.el7 will be installed
–> Running transaction check
—> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

==============================================================================
Package Arch Version Repository Size
==============================================================================
Installing:
php-devel x86_64 5.4.16-45.el7 rhel-7-server-optional-rpms 602 k
php-mbstring x86_64 5.4.16-45.el7 rhel-7-server-optional-rpms 505 k
Installing for dependencies:
pcre-devel x86_64 8.32-17.el7 rhel-7-server-rpms 480 k

Transaction Summary
==============================================================================
Install 2 Packages (+1 Dependent package)

Total download size: 1.5 M
Installed size: 6.7 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): php-mbstring-5.4.16-45.el7.x86_64.rpm | 505 kB 00:06
(2/3): php-devel-5.4.16-45.el7.x86_64.rpm | 602 kB 00:07
(3/3): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:07
——————————————————————————
Total 216 kB/s | 1.5 MB 00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pcre-devel-8.32-17.el7.x86_64 1/3
Installing : php-devel-5.4.16-45.el7.x86_64 2/3
Installing : php-mbstring-5.4.16-45.el7.x86_64 3/3
Verifying : php-mbstring-5.4.16-45.el7.x86_64 1/3
Verifying : php-devel-5.4.16-45.el7.x86_64 2/3
Verifying : pcre-devel-8.32-17.el7.x86_64 3/3

Installed:
php-devel.x86_64 0:5.4.16-45.el7 php-mbstring.x86_64 0:5.4.16-45.el7

Dependency Installed:
pcre-devel.x86_64 0:8.32-17.el7

Complete!
[root@mail /]#

 
Leave a comment

Posted by on August 20, 2018 in Documents, Linux, PostgreSQL, Zabbix

 

psql: FATAL: Peer authentication failed for user “zabbix”

If you getting error as following, just alter your pg_hba.conf file.

[root@mail zabbix-server-pgsql-4.0.0]# zcat create.sql.gz | psql -U zabbix -d zabbix
psql: FATAL: Peer authentication failed for user “zabbix”

Open file pg_hba.conf

# vi /var/lib/pgsql/9.5/data/pg_hba.conf

local all all peer
host all all 127.0.0.1/32 ident

try to change as follow

local     all       all                                md5
host      all      all      127.0.0.1/32     md5

 
Leave a comment

Posted by on August 14, 2018 in Linux, PostgreSQL, Zabbix

 

How to Install and Configure PostgreSQL Replication with Hot Standby on CentOS 7

How to Install and Configure PostgreSQL Replication with Hot Standby on CentOS 7

To Install PostgreSQL on Master and Slave Server

# yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
# yum install postgresql95-server postgresql95-contrib
# /usr/pgsql-9.5/bin/postgresql95-setup initdb
# passwd postgres
# su – postgres
postgres=# psql
postgres=# \conninfo
postgres=# CREATE USER replica REPLICATION LOGIN ENCRYPTED PASSWORD ‘replication@123’;
postgres=# \du

List of roles
Role name | Attributes | Member of
———–+————————————————————+———–
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
replica | Replication | {}
zabbix | | {}

# cd /var/lib/pgsql/9.5/data/
# vi postgresql.conf

listen_addresses = ‘localhost,10.100.100.123’
#To enable read­only queries on a standby server
wal_level = hot_standby
#Set the maximum number of concurrent connections from the standby servers.
max_wal_senders = 5
#To prevent the primary server from removing the WAL segments required for the standby server
wal_keep_segments = 32
#Enable WAL archiving on the primary to an archive directory accessible from the standby
archive_mode = on
archive_command = ‘cp -i %p /var/lib/pgsql/9.5/data/archive/ %f’

# vi /var/lib/pgsql/9.1/data/pg_hba.conf
#The standby server(slave) must have superuser access privileges.
host replication replication 10.100.100.0/16 md5

# systemctl start postgresql-9.5
# systemctl enable postgresql-9.5

Re-start postgres on the primary server and check if the parameters are affected

-bash-4.2$ psql
psql (9.5.7)
Type “help” for help.

postgres=# show archive_command ;
archive_command
———————————————-
cp -i %p /var/lib/pgsql/9.5/data/archive/ %f
(1 row)

postgres=# show archive_mode ;
archive_mode
————–
on
(1 row)

postgres=# show wal_level ;
wal_level
————-
hot_standby
(1 row)

postgres=# show max_wal_senders ;
max_wal_senders
—————–
3
(1 row)

postgres=# show wal_keep_segments ;
wal_keep_segments
——————-
8
(1 row)

postgres=#

Slave-server Configuration:-

# cd /var/lib/pgsql/9.5/data/
# vi postgresql.conf

listen_addresses = ‘localhost,10.100.100.125’
wal_level = hot_standby
max_wal_senders = 3
wal_keep_segments = 8
hot_standby = on

# systemctl stop postgresql-9.5

Syncronize Data from Master server to Slave server:-

# su – postgres
-bash-4.2$ cd /var/lib/pgsql/9.5
-bash-4.2$ mv data backups/data_original
-bash-4.2$ pg_basebackup -h 10.100.100.123 -D /var/lib/pgsql/9.5/data -U replica -v -P

# cd /var/lib/pgsql/9.5/data/
# vim recovery.conf

standby_mode = ‘on’
primary_conninfo = ‘host=10.100.100.123 port=5432 user=replica password=replicauser@’
restore_command = ‘cp /var/lib/pgsql/9.5/data/archive/%f %p’
trigger_file = ‘/tmp/postgresql.trigger.5432’

# systemctl start postgresql-9.5

Testing:-

su – postgres
psql -x -c “select * from pg_stat_replication;”

to create a new database from the master server and then check that the database exist on the slave server.

su – postgres
psql
create database test_db;

to check slave server

su – postgres
psql
\list

 
Leave a comment

Posted by on July 25, 2017 in Cluster, Database, Linux, PostgreSQL, Zabbix

 

How to install Zabbix 3.0 with postgreSQL on CentOS 7 step by step

How to install Zabbix 3.0 on CentOS 7

Zabbix is Free and Open Source software for Monitoring tool.
The monitoring tool for network and application monitoring via SNMP, TCP, ICMP checks.

1.To install and start Apache packages

# yum install httpd httpd-devel -y
# systemctl start httpd
# systemctl enable httpd

2.To install and start postgreSQL packages

# yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
# yum install postgresql95-server postgresql95-contrib

To Create the database cluster:

# /usr/pgsql-9.5/bin/postgresql95-setup initdb
# systemctl start postgresql-9.5
# systemctl enable postgresql-9.5

Adjust the pg_hba.conf, allowing local access without password, replacing:
# vi /etc/postgresql/9.5/main/pg_hba.conf

# “local” is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust

To Create the database and user zabbix:

# psql -U postgres

CREATE USER zabbix;
ALTER USER “zabbix” WITH PASSWORD ‘new_password’;
CREATE DATABASE zabbix OWNER zabbix;
\q

 

3.To install php packages

#yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml

# vi /etc/php.ini

date.timezone = “Asia/Kolkata”

# /etc/init.d/httpd restart

 

4.To install YUM repository for zabbix

# yum install http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

5.To Install Zabbix Server with MySQL

# yum install zabbix-server-pgsql zabbix-web-pgsql zabbix-agent zabbix-get

6.To Create Zabbix postgresSQL Database

# cd /usr/share/doc/zabbix-server-pgsql-3.0.4/
# zcat create.sql.gz | psql -U zabbix -d zabbix

7.Setup Zabbix Apache Configuration

# vi /etc/httpd/conf.d/zabbix.conf

php_value date.timezone Asia/Kolkata

# systemctl restart httpd

8. Adjust the /etc/zabbix/zabbix_server.conf, adding:

DBUser=zabbix
DBPort=5432
DBHost=localhost
DBPassword = Password

8.To Start Zabbix Server & Agent

# systemctl restart zabbix-server
# systemctl enable zabbix-server

# systemctl restart zabbix-agent
# systemctl enable zabbix-agent

9. https://IP_Address/zabbix or https://hostname/zabbix

 
Leave a comment

Posted by on July 19, 2017 in Linux, PostgreSQL, Zabbix