6 Uninstalling NRF

This chapter provides information about uninstalling Oracle Communications Cloud Native Core, Network Repository Function (NRF).

6.1 Uninstalling NRF Using Helm

To uninstall NRF, run the following command:

Run the following command to completely delete or remove the NRF deployment:
helm uninstall <helm-release> -n <namespace>

Where, <helm-release> is a name provided to identify the Helm deployment.

<namespace> is the name provided to identify the namespace of NRF deployment.

For example:

helm uninstall ocnrf -n ocnrf
Helm keeps a record of its releases, so you can still reactivate the release after uninstalling it.
To verify the NRF uninstallation, run the following command:
$ kubectl get all -n <release-namespace>

In case of successful uninstallation, no NRF resource is displayed in the command output.

If the command output displays the NRF resources or objects, then perform Deleting Kubernetes Resources.

If the command output displays any Kubernetes namespace, then perform the Deleting Kubernetes Namespace.

6.2 Deleting Kubernetes Resources

This section describes how to delete Kubernetes resources or objects where NRF is deployed.

Caution:

Be sure before running the following commands as it deletes all the Kubernetes objects in the specified namespace.
  1. Run the following command to delete all the Kubernetes objects:
    kubectl delete all --all -n <release-namespace>
  2. Run the following command to delete all the configmaps:
    kubectl delete cm --all -n <release-namespace>

    Caution:

    If the user has created RBAC and service account details before Helm, installing in the same namespace is required, do not delete RBAC and service account details. In case a custom service account is not provided by the user, and it is safe to remove it, then run the following commands to delete the resources or objects which are not required.
  3. Run the following command to delete the specific resources:
    kubectl delete <resource-type> <resource-name> -n <release-namespace>

6.3 Deleting Kubernetes Namespace

This section describes how to delete Kubernetes namespace where NRF is deployed.

Run the following command to delete the Kubernetes namespace:

Caution:

Be sure before removing the namespace as it deletes all the resources or objects created in the namespace.
kubectl delete namespace <ocnrf Kubernetes namespace>
For example:
kubectl delete namespace ocnrf

6.4 Deleting the MySQL Details

Single site

This procedure explains how to delete the NRF MySQL database after deletion of NRF deployment.

WARNING:

Procedure can be different for georedundant NRF sites and single NRF site.
  1. Log in to the machine which has permission to access the SQL nodes of NDB cluster.
  2. Connect to the SQL node of NDB cluster successively.
  3. Log in to the MySQL prompt using root permission or user, which has permission to delete the table records. For example: mysql -h 127.0.0.1 -uroot -p

    Note:

    This command may vary from system to system, path for MySQL binary, root user and root password. After running this command, the user must enter the password specific to the user mentioned in the command.
  4. Run the following commands to delete data specific to purged site:
    1. Delete the following data from NRF application database:
      $ DELETE FROM NfScreening WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NrfSystemOptions WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NfInstances WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NfStatusMonitor WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NfSubscriptions WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NrfEventTransactions WHERE recordCreator = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM SiteJsonSchemaVersionInfo WHERE SiteId = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM SiteIdToNrfInstanceIdMapping WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>'; 
    2. Delete the following data from NRF network database:
      $ DELETE FROM ReleaseConfig WHERE SiteId = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NfScreening_backup WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM NrfSystemOptions_backup WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
      $ DELETE FROM SiteIdToNrfInstanceIdMapping_backup WHERE recordOwner = '<NRF’s NF Instance ID of Site under deletion>';
    3. Delete the following data from NRF common configuration database:

      Note:

      For each georedundant site, the common configuration database name is different.
      $ DROP TABLE IF EXISTS 'common_configuration';
      $ DROP TABLE IF EXISTS 'common_configuration_backup';

    Caution:

    Since these tables are shared by each georedundant site, tables shall not be deleted.
  5. Delete the following data from NRF leaderElectionDB database:

    Note:

    For each georedundant site, the leaderElectionDB database name is different.
    $ DROP TABLE IF EXISTS 'leaderElectionDB';
    $ DROP TABLE IF EXISTS 'leaderElectionDB_backup';
  6. Exit from MySQL prompt and SQL nodes:

    Note:

    Run the commands on any one SQL node on one georedundant site. Other georedundant sites will get the data records removed automatically.

Multiple site

  1. Log in to the machine which has permission to access the SQL nodes of NDB cluster.
  2. Connect to the SQL node of NDB cluster successively.
  3. Log in to the MySQL prompt using root permission or user, which has permission to drop the tables. For example: mysql -h 127.0.0.1 -uroot -p

    Note:

    This command may vary from system to system, path for mysql binary, root user and root password. After running this command, user need to enter the password specific to the user mentioned in the command.
  4. Run the following commands to drop the tables:
    1. Drop the following tables from NRF application database:
      $ DROP TABLE IF EXISTS 'NfInstances';
      $ DROP TABLE IF EXISTS 'NfStatusMonitor';
      $ DROP TABLE IF EXISTS 'NfSubscriptions';
      $ DROP TABLE IF EXISTS 'NfScreening';
      $ DROP TABLE IF EXISTS 'NrfSystemOptions';
      $ DROP TABLE IF EXISTS 'NrfEventTransactions';
      $ DROP TABLE IF EXISTS 'SiteJsonSchemaVersionInfo';
      $ DROP TABLE IF EXISTS 'SiteIdToNrfInstanceIdMapping';
    2. Drop the following tables from NRF network database:
      $ DROP TABLE IF EXISTS 'ReleaseConfig';
      $ DROP TABLE IF EXISTS 'NfScreening_backup';
      $ DROP TABLE IF EXISTS 'NrfSystemOptions_backup';
      $ DROP TABLE IF EXISTS 'SiteIdToNrfInstanceIdMapping_backup'
    3. Drop the following tables from NRF common configuration database:
      $ DROP TABLE IF EXISTS 'common_configuration';
      $ DROP TABLE IF EXISTS 'common_configuration_backup';
    4. Delete the following data from NRF leaderElectionDb database:

      Note:

      For each georedundant site, the leaderElectionDb database name is different.
      $ DROP TABLE IF EXISTS 'leaderElectionDB';
      $ DROP TABLE IF EXISTS 'leaderElectionDB_backup';
    5. Delete the following NRF Auditor table from the leaderElectionDb database:
      $ DROP TABLE 'leaderElectionDB'.'NrfAuditorLeaderPod';
      $ DROP TABLE 'leaderElectionDB_backup'.'NrfAuditorLeaderPod';
  5. Exit from MySQL prompt and SQL node.

    Note:

    Run the commands on any SQL node of standalone site.

Procedure for complete removal of MySQL database and username

This procedure explains the steps to complete removal of MySQL database and username in below cases:

  1. NRF is not going to be installed on that cluster.
  2. Change the MySQL database name or MySQL user name.

Procedure

  1. Log in to the machine which has permission to access the SQL nodes of NDB cluster.
  2. Connect to the SQL node of NDB cluster successively.
  3. Log in to the MySQL prompt using root permission or user, which has permission to drop the tables. For example: mysql -h 127.0.0.1 -uroot -p

    Note:

    This command may vary from system to system, path for MySQL binary, root user and root password. After running this command, the user must enter the password specific to the user mentioned in the command.
  4. Run the following command to remove NRF databases:

    Remove NRF application database:

    $ DROP DATABASE if exists <NRF application database>;

    For example:

    $ DROP DATABASE if exists nrfApplicationDB;
    Remove NRF network scoped database:
    $ DROP DATABASE if exists <NRF network scoped database>;

    For example:

    $ DROP DATABASE if exists nrfNetworkDB;
    Remove NRF common configuration database:
    $ DROP DATABASE if exists <NRF common configuration database>;

    For example:

    $ DROP DATABASE if exists commonConfigurationDB;
  5. Delete the following data from NRF leaderElectionDb database:

    Note:

    For each georedundant site, the leaderElectionDb database name is different.
    $ DROP TABLE IF EXISTS 'leaderElectionDB';
    $ DROP TABLE IF EXISTS 'leaderElectionDB_backup';
  6. Run the following command to remove the NRF MySQL Users:

    Remove NRF privileged user:

    $ DROP USER IF EXISTS <NRF Privileged-User Name>;

    Example

     $ DROP USER IF EXISTS nrfPrivilegedUsr;
    Remove NRF application user:
    $ DROP USER IF EXISTS <NRF Application User Name>;
    Example
    $ DROP USER IF EXISTS nrfApplicationUsr;

    Caution:

    Removal of MySQL Users must be done on all the SQL nodes from all the NRF sites.
  7. Exit from MySQL prompt and SQL node.