[pg94@db1 ~]$ mkdir -p /database/pg94/pg_tbs/tbs_zabbix [pg94@db1 ~]$ psql -h 127.0.0.1 psql (9.4beta1) Type "help" for help. postgres=# CREATEROLE zabbix LOGIN ENCRYPTED PASSWORD'zabbix' nosuperuser noinherit nocreatedb nocreaterole ; CREATEROLE [pg94@db1 ~]$ psql -h 127.0.0.1 psql (9.4beta1) Type"help"for help. postgres=# create tablespace tbs_zabbix owner postgres LOCATION '/database/pg94/pg_tbs/tbs_zabbix'; CREATE TABLESPACE postgres=# CREATEDATABASE zabbix postgres-# WITH OWNER = postgres postgres-# TEMPLATE = template0 postgres-# ENCODING = 'UTF8' postgres-# TABLESPACE = tbs_zabbix; CREATEDATABASE postgres=# grantallondatabase zabbix to zabbix withgrantoption; GRANT postgres=# grant all on tablespace tbs_zabbix to zabbix; GRANT
导入 zabbix 数据
1 2 3 4
[pg93@db1 ~]$ cd /opt/soft_bak/zabbix-2.2.6/database/postgresql/ [pg94@db1 postgresql]$ psql -h 127.0.0.1 -d zabbix -U zabbix -a -f schema.sql [pg94@db1 postgresql]$ psql -h 127.0.0.1 -d zabbix -U zabbix -a -f images.sql [pg94@db1 postgresql]$ psql -h 127.0.0.1 -d zabbix -U zabbix -a -f data.sql
备注: zabbix 数据库字符集为 UTF-8。
编译
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[root@db1 zabbix-2.2.6]# mkdir /usr/local/zabbix [root@db1 zabbix-2.2.6]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-postgresql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 编译报错 .... checking forfile /proc/stat... yes checking for file /proc/cpuinfo... yes checking for file /proc/0/psinfo... no checking for file /proc/loadavg... yes checking for file /proc/net/dev... yes checking for long long format... no checking for -rdynamic linking option... yes checking for libperfstat 5.2.0.40 fileset... no checking for libperfstat 5.3.0.60 fileset... no checking for architecture... linux (linux-gnu) checking for the linux kernel version... 2.6 family (2.6.32-220.el6.i686) checking size of void *... 4 checking for Oracle support... no checking for pg_config... no configure: error: PostgreSQL library not found