Automatic MySQL backups from master server hangs for Windows clients or does not generate child streams.

Automatic MySQL backups from master server hangs for Windows clients or does not generate child streams.

Article: 100047943
Last Published: 2022-08-05
Ratings: 2 0
Product(s): NetBackup

Problem

Child streams are not generated when the MySQL policy is triggered from master server. Running the nbmysql command directly from client machine is successful.
bphdb logs would loop and an * would be logged in the logs. It is waiting for the password to be entered.
bphdb could report "System cannot find the path Specified" or report issues with the MySQL library file by reporting "Failed to load the MySQL library: "...\libmysql.dll" : The specified module could not be found"

Error Message

No evident errors are reported, bphdb  standard out logfile shows that the agent is prompting for the Database password to be input.
Running the same nbpgsql command directly from a command prompt would successfully trigger the backup.
.out file created under bphdb log folder could report "System cannot find the path Specified" or report issues with the MySQL library file by reporting "Failed to load the MySQL library: "...\libmysql.dll" : The specified module could not be found" 

Location of bphdb log is INSTALL PATH/netbackup/logs

Cause

Password less authentication is configured for the Default Administrator account or some particular Windows account while NetBackup services are running as LSA (Local System Account) or a different account
Windows environment variables are not correct configured

Solution

1. Test whether you are able to manually execute the nbmysql command and take a backup directly from the client machine. Below is an example:
"C:\Program Files\Veritas\NBMySQLAgent\nbmysql.exe" -o backup -S nbmaster -P mysql-win -s Default-Application-Backup -l "C:\Program Files\MySQL\MySQL Server 8.0\lib"

If NetBackup services are running as LSA, this test needs to be performed from the command prompt for LSA, steps on how to open a command prompt as LSA are mentioned at the end of the article.

If there are any connection errors reported, execute - "mysql -u <username> -p" and enter the password to connect to mysql prompt and then run "use <database-name>" to connect to the database. This will help validate the password being provided.

Example:


2. To ensure the mylogin.cnf file is created in the correct path there are 2 methods. Preferred method is the automatic one which would allow mysql config editor to create the file in the appropriate path.

Manual method:

Locate the .mylogin.cnf file and verify that NetBackup Client service is also running as the same user where the file is located. 

If  NetBackup services are running as LSA then the .mylogin.cnf must be created in the APPDATA path of the LSA account. As a workaround if the NetBackup services logon account is changed to run as the Administrator account or the account under which the file is created the backups would still work.

>> FOR LSA (Local System Account)
       C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\MySQL\.mylogin.cnf

>> FOR Default Administrator Account
       C:\Users\Administrator\AppData\Roaming\MySQL\.mylogin.cnf

Note: Do not forget the folder named MySQL under the app-data folder while creating the file.
Detailed information on identifying the LSA home path and environment variables are mentioned below

Preferred method for automatic creation of ini file in the correct path

Open command prompt as LSA following the steps outlined in the article later on using psexec command.
From this command prompt execute the below mysql-editor command (username would change is customer is using a different user)
       mysql_config_editor.exe set --login-path=3306  --user=root --password

To validate password-less authentication is working outside of NetBackup
Open command prompt as LSA or the user with which NetBackup Client service is running and execute the below command. This should connect to mysql prompt directly and confirm whether password-less authentication is working 
     mysql --login-path=3306

Example:

3. For the particular user validate the Path variable contains the following

  1. Path for <install_path>\NetBackup\bin
  2. Path for mysql_library_path - Example: C:\Program Files\MySQL\MySQL Server 8.0\lib
  3. Path for mysql_bin_folder - Example: C:\Program Files\MySQL\MySQL Server 8.0\bin

4. Ensure that nbmysql.conf has the correct parameters configured especially the user-name. 

5. In the script being used for the backup specify the complete path for the command to be executed along with the library path. 

A sample script is attached in the article that can be used to configure MySQL backups for windows clients. Rename the file from mysql_backup-cmd.txt to mysql_backup.cmd

Disclaimer:
Please note that this script is provided as a sample script only. The script is not supported by Veritas technical support.

It is the responsibility of the customer to modify the script to take into account specific requirements and variables in his/her environment.


To identity the APPDATA folder and Path variables configured for LSA, we can use the Windows tool called as PsExec which can be downloaded from the below Microsoft Link
https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

Once downloaded, running - "psexec -i -s cmd.exe" will open up a new command window as LSA. 
Running the "whoami" command you can confirm that you are running as LSA

 

Was this content helpful?