Database Maintenance Utility
The LSMS Database Command-Line Utility (a MySQL client), $LSMS_TOOLS_DIR/lsmsdb, provides the capability of obtaining information and performing maintenance operations on the LSMS database. Additionally, the lsmsdb command is used to provide information and perform operations to configure query servers.
The syntax for lsmsdb as used within this document is as follows:
Permission
The user can be root or be defined as a member of the primary group lsms.
Syntax
$LSMS_TOOLS_DIR/lsmsdb -c <command> [-b <basedir>] [-d <database>] [-h <hostname>] [-p <password>] [-u <username>]
-c <command> Options
- adduser
- Creates TPD and MySQL users, both with the same password. Must be run as root.When the adduser command option is specified, the -u <username> option is required.
- addrepluser
- Sets up a special replication user at the LSMS with privileges and permission that a query server can use to access the LSMS and perform database replication. When the addrepluser command option is specified, the -h <hostname> and -p <password> options are required. SECURITY NOTE: The combination of username and password is unique to replication use and only provides read access to the resynchronization binary log on the LSMS system. Additionally, access to this user account is restricted to the hostname specified. If the maximum number of EAGLE nodes supported would be exceeded, the command terminates with the following error:
"Failed: The maximum number of eagles supported has been reached."
- chguserpw
- Allows modification of the TPD and MySQL passwords. Can be run as root, or as the user who wants to change the password. When the chguserpw command option is specified, the -u <username> option is required.
Note: The lsmsdb - c chguserpw - u <username> command must be run on both the primary and the secondary servers to completely change the password.
- counts
- Displays counts of records in specified database.
- dblist
- Displays list of databases (if the -d option is specified, it is ignored).
- features
- Displays current settings of all optional features.
- users
- Lists all defined LSMS GUI users.
- masterstatus
- Displays status information (log name and position) on the binary log of the master server (LSMS).
- ping
- Pings the mysqldaemon.
- queryservers
- Displays the connection status of all query servers that are directly connected to the LSMS. The connection status for each query server (denoted by hostname and IP address) is displayed as Connected, Disconnected, Not Reachable, or Hostname not associated with IP address. For this command to show correct connection status between LSMS and a query server, a new user must be created on the query server. For information about how to create this user to check replication status from LSMS, see the Query Server Installation and Upgrade Instructions.
- quickaudit
- Performs a quick comparison of the number of rows in all of the database tables on both the active and standby servers. It returns "0" if the comparison on the active and standby servers results in a match; it returns various error numbers and error messages if the comparison does not produce a match or if a problem was encountered.
Note: Do not specify this option when the LSMS is performing bulk download. In addition, do not specify this option when any of the following processes are running, due to the possibility of disk space shortage: backups, starting a standby node (to change its state from UNINITIALIZED "INHIBITED" to STANDBY), running the
import command, and creating query server snapshots. Since backups can be run automatically, perform the procedure described in
Checking for Running Backups to ensure that no backups are running.
This option:
- Takes about 5 seconds to run.
- Must be run from the active server.
- Checks first to see if the standby server is more than 5 seconds behind the active server; if it is, an error message is generated and quickaudit does not proceed.
- rmrepluser
- Removes a replication user at the LSMS. When the rmrepluser command option is specified, the -h <hostname> option is required.
- rmuser
- Deletes TPD and MySQL users. Must be run as root. When the rmuser command option is specified, the -u <username> option is required.
- shutdown
- Stops mysql (if the -d option is specified, it is ignored).
- snapshot
- Creates a snapshot of the LSMSLNP database to be used to setup query servers and/or for disaster recovery.When the snapshot command option is specified, the -b <basedir> option is optional.
During the creation of a snapshot of the LSMS LNP database, the following occurs:
-
A read lock will be obtained
-
Table information is flushed
-
Binary logs (if already existing) are removed and a new one started (with log numbered 1)
-
MySQL server performs a shutdown
-
All LSMS database tables are archived as compressed files, mysql-snapshot-supDB.tar.gz and mysql-snapshot-<regionDB>.tar.gz (by default in /var/TKLC/lsms/db, although the -b option changes this base directory)
-
MySQL server is restarted
-
The read lock is released
- start
- Starts mysql (if the -d option is specified, it is ignored).
- syspwexp
- Modifies the system level defaul password timeout interval.
- usrpwexp
- Modifies the user level defaul password timeout interval, the -u <username> option is required.
Options
- -b basedir
- Base directory for storing snapshots.
- -d database
- Run the command on the database specified by this option. If the -d option is not specified, the command is run on all databases.
- -h hostname
- Name of the host.
- -p password
- User’s password.
- -u username
- LSMS user’s username.
Note: The -c flag is required.
Sample Input and Output
$ ./lsmsdb -c features
Y AFT
Y EDR
Y ENHANCED_FILTERS
Y HTTP
Y HTTPS
16 MAX_EAGLES
32 MAX_SPIDS
8 MAX_USERS
Y QUERY_SERVER
Y REPORT_GEN
0 REPORT_GEN_QUERY_ACTIVE
Y SNMP
Y SPID_SECURITY
Y WSMSC
N WSMSC_TO_EAGLE
$ ./lsmsdb -c counts -d NortheastDB
1 ............. NortheastDB.NumberPoolBlock
1 ............. NortheastDB.ServiceProvLRN
0 ............. NortheastDB.ServiceProvNPA_NXX
0 ............. NortheastDB.ServiceProvNPA_NXX_X
1 ............. NortheastDB.ServiceProvNetwork
39,756 ........ NortheastDB.SubscriptionVersion
$ $LSMS_TOOLS_DIR/lsmsdb -c addrepluser -h queryserver1 -p password $ $LSMS_TOOLS_DIR/lsmsdb -c masterstatus
Lsmspri-bin.001 73
$LSMS_TOOLS_DIR/lsmsdb -c queryservers
queryserver1 (10.25.60.28) Connected
queryserver2 (10.25.60.45) Disconnected
queryserver3 (10.25.60.31) Not Reachable
queryserver4 (Unknown) Hostname not associated with IP address
$LSMS_TOOLS_DIR/lsmsdb -c rmrepluser -h queryserver1 -p password $LSMS_TOOLS_DIR/lsmsdb -c snapshot
WARNING: For the duration of this command, traffic being sent from the NPAC to connected network elements and local LSMS provisioning will be INTERRUPTED.
Do you want to continue? [Y/N] Y