Configuring Database
Introduction
Binding Support Function (BSF) microservices use MySQL database to store the configuration and run time data. Following microservices require dedicated MySQL databases created in MySQL data tier.- BSF Management Service - To store Binding session state
- Config Server - To store configuration data
Customizing Database Name
Service Name | Default Database Name |
---|---|
BSF Management Service | ocpm_bsf |
Config Server Service | ocpm_config_server |
It is recommended to use unique database name when there are multiple instances of BSF deployed in the network and they share the same data tier (MySQL cluster).
It is recommended to create custom unique database name, by simply prefixing the default database name with an identifier that uniquely identifies this instance of BSF deployment. This way database name uniqueness can be achieved across all deployments. However, you can use any prefix to create the unique database name. For example, if the OCBSF deployment name is "site1" then the BSF Management Service database can be named as " site1_ocpm_bsf". Refer the BSF Customization Parameters section for how to override default database names with custom database names.
Configuring MYSQL Database
Note:
This procedure must be performed only once before initiating the BSF deployment.To configure MYSQL database for the different microservices:
- Login to the server where the ssh keys are stored and SQL nodes are accessible.
- Connect to the SQL nodes.
- Login to the database as a root user.
- Create tables for the
different microservices:
Note:
User with admin privileges can create the tables.BSF Management Service
In the following script default database name " ocpm_bsf" is used, if custom database name is used then replace it wherever applicable.CREATE DATABASE IF NOT EXISTS `ocpm_bsf`; CREATE TABLE IF NOT EXISTS ocpm_bsf.pcf_binding ( binding_id binary(16) not null, ipv4_addr varchar(64), ip_domain varchar(128), ipv6_prefix varchar(64), mac_addr_48 varchar(64), dnn varchar(128), supi varchar(64), gpsi varchar(64), snssai_sd varchar(64), snssai_sst integer, created_date_time datetime(6) not null, json_content longblob not null, primary key (binding_id), key idx_created_date_time (created_date_time), key idx_ipv4Addr (ipv4_addr, created_date_time), key idx_ipv6Prefix (ipv6_prefix, created_date_time), key idx_macAddr48 (mac_addr_48, created_date_time), key idx_supi (supi, created_date_time), key idx_gpsi (gpsi, created_date_time) );
Config Server Service
In the following script default database name " ocpm_config_server" is used, if custom database name is used then replace it wherever applicable.CREATE DATABASE IF NOT EXISTS `ocpm_config_server`; CREATE TABLE IF NOT EXISTS `ocpm_config_server`.`topic_info` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Default Topics.', `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `modify_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `version` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_gd6b0a6mdpxc55qbibre2cldc` (`name`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE IF NOT EXISTS `ocpm_config_server`.`configuration_item` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `cfg_key` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `md5sum` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `cfg_value` mediumtext COLLATE utf8_unicode_ci, `version` int(11) NOT NULL, `topic_info_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), KEY `FKdue8drxn6acrdt63iacireky1` (`topic_info_id`) ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- Create the user and assign
it to a group having necessary permissions to access the tables on all of the
SQL nodes by executing the following command: :
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
where:username is the username and password is the password for MySQL database user.
For Example: In the below example, "bsfusr" is used as username, "bsfpasswd" is used as password.
CREATE USER 'bsfusr'@'%' IDENTIFIED BY 'bsfpasswd'; GRANT SELECT, INSERT, UPDATE, DELETE ON ocpm_bsf.* TO 'bsfusr'@'%'; GRANT SELECT, INSERT, UPDATE, DELETE ON ocpm_config_server.* TO 'bsfusr'@'%';
- Execute the command,
show databases
, to view database. - Exit from database and logout from MYSQL node.