This document has not been formally reviewed for accuracy and is provided "as is" for your convenience.
Summary
Reference
Problem Description:
Sometimes we need to access the internal DB of an SMAX environment, but we get confused specially if we are new to the product.
Cause:
Guidelines to do this are difficult to find and sometimes assume some kind of previous knowledge which is not always present.
Resolution:
Here a step by step guide on how to do it:
Identify the db pod name using:
[root@ult01vm0308 ~]# kubectl get pods --all-namespaces -o wide | grep post
Open a console inside the pod:
[root@ult01vm0308 ~]# kubectl exec -it itom-postgresql-default-79c99d694b-p2jh5 -n core -c itom-postgresql-default bash
this will get you the password of the DB:
itom-postgresql-default-79c99d694b-p2jh5:/docker-entrypoint-initdb.d # get_secret defaultdb_user_password
Use the pod IP and user postgres to gain access:
itom-postgresql-default-79c99d694b-p2jh5:/docker-entrypoint-initdb.d # psql -h 172.16.13.111 -p 5432 -U postgres
List all the DBs:
\list
Connec to the desired DB:
\connect <DB_NAME>
More examples of what you can do:
SELECT schema_name FROM information_schema.schemata
select * from pg_catalog.pg_tables;
select * from cdfidm.database_user;
select * from cdfidm.database_user where name = 'suite-admin'
Environment:
Tested on SMAX 2019.11.