Solved

add mysql instance


Userlevel 2
Badge +7

Hi,

 

We are trying to add mysql instance, but both cvpysdk and API failed to do so. 

 

For cvpysdk i opened github issue, but not sure it’s actively maintained? 

 

For API, using this page and example values:

 

curl -k -L -X POST 'https://commsrv/commandcenter/api/Instance' \

-H 'Content-Type: application/json' \

-H 'Accept: application/json' \

-H 'Authorization: Bearer [...]' \

--data-raw '{

  "instanceProperties": {

    "instance": {

      "instanceName": "aymasterr_3306",

      "applicationId": 104,

      "clientId": 461,

      "clientName": "a-o0"

    },

    "mySqlInstance": {

      "BinaryDirectory": "/usr/bin",

      "LogDataDirectory": "/var/lib/mysql",

      "ConfigFile": "/etc/my.cnf",

      "port": "/var/lib/mysql/mysql.sock",

      "EnableAutoDiscovery": true,

      "SAUser": {

        "userName": "root",

        "password": "cm9vdAo"

      },

      "proxySettings": {

        "isProxyEnabled": false,

        "proxyInstance": {

          "instanceId": 0

        },

        "isUseSSL": false,

        "runBackupOnProxy": false

      },

      "xtraBackupSettings": {

        "enableXtraBackup": true,

        "xtraBackupBinPath": "/usr/bin"

      },

      "mebSettings": {

        "enableMEB": false

      },

      "sslEnabled": false

    },

    "planEntity": {

      "planId": 8

    }

  }

}'

 

Output:

Request body is empty or format is invalid.

 

Webserver.log (debug=10):


15316 281   05/24 11:01:21 281 <validator> - Verifying Instance.CreateInstance arguments.

15316 281   05/24 11:01:21 281 <validator> - Instance.CreateInstance expects parameter 'CreateInstanceRequest req' value not to be null. Response status code set to BadRequest(400)

15316 281   05/24 11:01:21 281Invoke - WEBAPI-FINISHED processing [POST]:[/CVWebService.svc/Instance] in [12] ms;  HTTP code 'BadRequest' Out : (empty)

15316 246   05/24 11:01:21 246  SessionGuid - Token type is [Bearer] 

 

We are not able to figure our which values are missing and we’d love to see more clear debug output. 

Version is 11.32.54

Thanks! 

icon

Best answer by Ayush Kumar 28 May 2024, 15:23

View original

4 replies

Badge

Hi Iborek,

We will check cvpysdk operation and get back.

Regarding API request, kindly check the Request body section for more details for the required inputs and their format.

https://api.commvault.com/docs/SP32/api/cv/MySQLDatabases/post-instance

 

Values for the required inputs needs to be updated in request body.

 

Request body 

 

 

For reference,
Click MySQL Instance body under Request, copy the JSON payload and replace the values in payload as required.

Refer to the JSON payload below and retry the operation and let us know how it goes.

Database User password is required in base64 format.

 

Let us know in case you have any query.

Create MySQL Instance body
 

 

Create MySQL Instance API request

 

{

  "instanceProperties": {

    "instance": {

      "instanceName": "ayrhel9_api_3306",

      "applicationId": 104,

      "clientId": 24,

      "clientName": "ayrhel9"

    },

    "mySqlInstance": {

      "BinaryDirectory": "/usr/bin",

      "LogDataDirectory": "/var/lib/mysql",

      "ConfigFile": "/etc/my.cnf",

      "port": "ayrhel9:3306",

      "EnableAutoDiscovery": true,

      "SAUser": {

        "userName": "root",

        "password": ""

      },

      "NTUser": {

        "userName": "",

        "password": ""

      },

      "proxySettings": {

        "isProxyEnabled": false,

        "proxyInstance": {

          "instanceId": 0

        },

        "isUseSSL": false,

        "runBackupOnProxy": false

      },

      "xtraBackupSettings": {

        "enableXtraBackup": false

      },

      "mebSettings": {

        "enableMEB": false

      },

      "sslEnabled": false

    },

    "planEntity": {

      "planId": 33

    }

  }

}

 

Userlevel 2
Badge +7

Thanks @Ayush Kumar 

Changing password do base64 did the work. Thanks for help. I copy-paste example with plain text. 

What’s best way to debug such problems? As Webserver.log output was useless even using debug=10. 

Badge

@lborek

In case of any format or mismatch in expected value type, we don’t have much flexibility to debug with higher log level. 

Based on the error message, we need to refer to the request body structure mentioned in documentation to resolve the error.

Userlevel 2
Badge +7

Thanks. 

Reply