Setting up Db2 Graph on Cloud Pak for Data
To set up your Db2® Graph service, you must make changes to the db2ucluster custom resource, either during or after you provision the Db2 Warehouse service instance.
Procedure
-
Find your respective db2ucluster resource by running the following
command:
oc get db2ucluster
The command results will match your deployment ID, in the example below db2wh-1603819662989:NAME STATE AGE db2wh-1603819662989 Ready 34m
-
Run the following command to edit the db2ucluster custom resource:
oc edit db2ucluster deployment_ID
Set the graph value toenabled: true
. The edited resource should look like the following example:addOns: graph: enabled: true
Add a storage class for graph. Under the storage: heading, you can define the graph storage class, allocating the store size and storageClassName as applicable for your environment. In this example, 5 GB of manage-nfs-storage are allocated to Db2 Graph:- name: graph spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi storageClassName: managed-nfs-storage type: create
-
Run the following command to view the Graph service and deployment information:
oc get formations.db2u.databases.ibm.com db2wh-1603819662989 -o go-template='{{range .status.components}}{{printf "%s,%s,%s\n" .kind .name .status.state}}{{end}}' | column -s, -t
The results should look similar to the following example:service c-db2wh-1603819662989-db2u-graph-svc Creating Deployment c-db2wh-1603819662989-graph Creating
-
Run the following command to view the Graph pod as part of your deployment:
oc get pods |grep db2
Here is an example with the Graph pod highlighted:c-db2wh-1603819662989-db2u-0 1/1 Running 0 50m c-db2wh-1603819662989-etcd-0 1/1 Running 0 50m c-db2wh-1603819662989-graph-5d4b8b694c-nd4jw 1/1 Running 0 56s c-db2wh-1603819662989-instdb-df7hh 0/1 Completed 0 51m c-db2wh-1603819662989-ldap-64bc6d58dc-ms29x 1/1 Running 0 51m c-db2wh-1603819662989-rest-66f7fcb7d4-98fbh 1/1 Running 0 12m c-db2wh-1603819662989-restore-morph-bkfpr 0/1 Completed 0 50m c-db2wh-1603819662989-tools-57bc7d4ddf-wz8fr 1/1 Running 0 51m
Take note of the Graph pod name as it will be referred to as GRAPH_POD_NAME and used to execute commands in the remainder of the documentation.
-
After your initial deployment, query the logs and take note of the password presented for the
graph_admin and graph_user accounts. You will need the
password in order to log into the Db2 Graph
user interface or to programmatically access Db2 Graph.
Run the following command to view the Graph pod deployment logs:
oc logs <GRAPH_POD_NAME>
#################################################################################### ### Db2 Graph passwords for users graph_admin and graph_user have been ### ### initialized to: 8VmO@b8nCLFTGruQPObllS7c6velm ### ### To change the initial passwords, use the manage user command. ### #################################################################################### Starting the Db2 Graph server... Db2GRAPH-1000I The Db2 Graph server is running. #################################################################################### ### IBM Db2 Graph was started successfully. ### #################################################################################### * To return to the host after viewing and accepting the license, press Ctrl+p followed by Ctrl+q. * To manage the Db2 Graph server, issue the following command for more information: [ docker | oc | kubectl -n <NS> ] exec -it <graph container name> manage ####################################################################################
To change the randomly generated default password for either graph_admin or graph_user, execute the following command:oc exec -it GRAPH_POD_NAME manage user
Select the graph_admin or graph_user account and enter a password. If you want to change both passwords, repeat the process for the other user. When you have completed changing passwords, run the following command to restart Db2 Graph:oc exec -it GRAPH_POD_NAME manage restart