Hello Guys!
Is there any manual, how to migrate to DB postgresql?
I was trying to do next:
apt-get download zabbix-server-pgsql
dpkg -x zabbix-server-pgsql_* ./zabbix-server-pgsql
gzip -dc ./zabbix-server-pgsql/usr/share/doc/zabbix-server-pgsql/create.sql.gz > schema.sql
sed -n '/CREATE.*/,/INSERT.*$/p' schema.sql | head -n-1 > createonly.sql
grep ALTER schema.sql > alter.sql
su -u postgres createuser --pwprompt zabbix
su -u postgres createdb -O zabbix zabbix
cat > zabbix.load << EOF
LOAD DATABASE
FROM mysql://zabbix:zabbix_password@localhost/zabbix
INTO postgresql://zabbix:zabbix_password@localhost/zabbix
WITH include no drop,
truncate,
create no tables,
create no indexes,
no foreign keys,
reset sequences,
data only
SET maintenance_work_mem TO '128MB', work_mem to '12MB'
ALTER SCHEMA 'zabbix' RENAME TO 'public'
BEFORE LOAD EXECUTE createonly.sql
AFTER LOAD EXECUTE alter.sql;
EOF
pgloader zabbix.load
And when execute pgloader i have next error:
2019-10-01T07:20:22.164000Z ERROR Database error 42830: "hosts" ,
QUERY: ALTER TABLE ONLY hosts ADD CONSTRAINT c_hosts_1 FOREIGN KEY (proxy_hostid) REFERENCES hosts (hostid)
2019-10-01T07:20:22.164000Z FATAL An unhandled error condition has been signalled:
Database error 42830: "hosts" ,
QUERY: ALTER TABLE ONLY hosts ADD CONSTRAINT c_hosts_1 FOREIGN KEY (proxy_hostid) REFERENCES hosts (hostid)
OR
psql -d zabbix < alter.sql
ERROR: there is no uniqueness constraint in the target 'hosts' external table corresponding to these keys
Is there any manual, how to migrate to DB postgresql?
I was trying to do next:
apt-get download zabbix-server-pgsql
dpkg -x zabbix-server-pgsql_* ./zabbix-server-pgsql
gzip -dc ./zabbix-server-pgsql/usr/share/doc/zabbix-server-pgsql/create.sql.gz > schema.sql
sed -n '/CREATE.*/,/INSERT.*$/p' schema.sql | head -n-1 > createonly.sql
grep ALTER schema.sql > alter.sql
su -u postgres createuser --pwprompt zabbix
su -u postgres createdb -O zabbix zabbix
cat > zabbix.load << EOF
LOAD DATABASE
FROM mysql://zabbix:zabbix_password@localhost/zabbix
INTO postgresql://zabbix:zabbix_password@localhost/zabbix
WITH include no drop,
truncate,
create no tables,
create no indexes,
no foreign keys,
reset sequences,
data only
SET maintenance_work_mem TO '128MB', work_mem to '12MB'
ALTER SCHEMA 'zabbix' RENAME TO 'public'
BEFORE LOAD EXECUTE createonly.sql
AFTER LOAD EXECUTE alter.sql;
EOF
pgloader zabbix.load
And when execute pgloader i have next error:
2019-10-01T07:20:22.164000Z ERROR Database error 42830: "hosts" ,
QUERY: ALTER TABLE ONLY hosts ADD CONSTRAINT c_hosts_1 FOREIGN KEY (proxy_hostid) REFERENCES hosts (hostid)
2019-10-01T07:20:22.164000Z FATAL An unhandled error condition has been signalled:
Database error 42830: "hosts" ,
QUERY: ALTER TABLE ONLY hosts ADD CONSTRAINT c_hosts_1 FOREIGN KEY (proxy_hostid) REFERENCES hosts (hostid)
OR
psql -d zabbix < alter.sql
ERROR: there is no uniqueness constraint in the target 'hosts' external table corresponding to these keys
Comment