Reinstalling Postgres

Not applicable

We have a test environment with a blown up Postgres install. Following the below steps yields a "Cannot Init DB" during the install when using the /opt/apigee4/share/installer/apigee-postgres-install.sh during Step 3 and never reinstalls the postgresql process. Postgres-Server seems to install but obviously won't start right.

Install is a 3 node system with QPID/Postgres residing on the same server.

Postgres DB

1) Stop postgresql on all master and standby nodes

2) Remove old postgresql

[node]# SERVICE=pgsql

[node]# rm -fr $INST_DIR/share/${SERVICE}*

[node]# SERVICE=postgresql

[node]# rm -fr $INST_DIR/conf/${SERVICE}

[node]# rm -fr $INST_DIR/data/${SERVICE}

[node]# rm -fr $INST_DIR/var/log/${SERVICE}

3) Re-install postgresql.

Note that the script takes configuration from $INST_DIR/bin/apigee-env.sh.

[node]# $INST_DIR/share/installer/apigee-postgres-setup.sh

4) Restore postgresql

[node]# $INST_DIR/bin/restore-postgres.sh -b $BACKUP_PATH -d $BACKUP_DATE

5) Restart all Postgres Servers.

Note that the restored node will be the master. You can change other Postgres Server to standby, if necessary.

Below is the output from Step 3:

[node]#:~> /opt/apigee4/share/installer/apigee-postgres-setup.sh

Checking prerequisites

Checking if following packages are installed:

kernel.sem: OK

kernel.shmmax: OK

kernel.shmall: OK

Installing postgres

Finished installing postgres

Starting Postgres Setup

Cannot init DB

[node]#:~>

0 6 1,340
6 REPLIES 6

are you running the installer as root?

did the apigee-install.sh create 'apigee' user?

check the permissions for /opt/apigee4, in case of root install - postgres process will be run as 'apigee' user, so apigee user need to have permissions on this folder

If not root, then the local user need to have permissions on /opt/apigee4 folder

Due to our environment, the apigee user is a local user that does have permissions to that folder and is the user we're running the install under. Apigee user should have been the user that performed the original install.

i remember seeing this error, but that was due to permissions - maybe this is different, which OS? and what version of opdk, is it 15.04?

+ @Maudrit @Paul Mibus

Oracle Linux Server release 6.3

OPDK 15.04 with 15.04.03 patch.

I find it somewhat unlikely to be permissions, it's a similar setup to all of the installs we have and they've been done using the local apigee user in the past.

Hi Bryant,

i think when i saw this error earlier - it was RHEL and the system was not registered with RHEL so it wasn't able to get the version of PG needed.

I think the latest installer needs postgresql93,

can you check what is the version you have - try 'yum search' or 'rpm -q' ? i am guessing you are having an older version

If its the version issue, then you might need to update to the new version or can download the rpms and install it.

Alternatively,

What version of apigee you currently have? I guess you might be able to install the older version and upgrade to the new version if its not possible to overcome the postgres issue.

Thanks,

Not applicable

Hi @Bryant Olson ,

I ran into the same issue Today on my aio setup . You can find the reason why db initialisation is not happening in this file pgstartup.log.

In my case it said the below and same when I ran sudo service postgresql initdb too

initdb: file "/usr/share/pgsql/postgres.bki" does not exist
This might mean you have a corrupted installation or identified
the wrong directory with the invocation option -L

I uninstalled postgres , ran the apigee-postgres-install-prerequisites.sh and ran setup again which fixed the problem .

It might not be the same issue in your case but I believe pgstartup.log will give you some info .