No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

FusionCloud 6.3.1.1 Troubleshooting Guide 02

Rate and give feedback :
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
FAQs

FAQs

How Do I View Logs About DB Instance Creation?

If you fail to create an instance, you need to view logs about the instance creation to locate problems.

Procedure
  1. Connect to the database and query the DB instance ID based on the DB instance name.

    Log in to the Linux server of each RDSService node. Run the following command on each node to filter RDSService backend logs by instance name:
    grep "instance ID" /opt/dbs/tomcat/mysql-instancemanager/logs/mysql/* > createRdsInstance.log
    NOTE:
    • You need to add an asterisk (*) at the end of /opt/dbs/tomcat/mysql-instancemanager/logs/mysql/, so that all files in the directory will be scanned.
    • The query results of 1 consist of query results on all the RDSService nodes.
    • As there are many instance creation logs, you can run > createRdsInstance.log to redirect logs to the createRdsInstance.log temporary file, so that you can conveniently view, search, and perform other operations to the filtered logs. Delete this file if you no longer use it.

    The query result is as follows:

    Figure 20-3 Filter result
    NOTE:
    • 67a2a5c25c1d4451aa1112048a9e3e71in01 indicates the instance ID.
    • 8532ae32-eb47-4a8d-95b4-e3e22141d1d9 indicates the workflow ID.
    • 2017-09-22 12:20:58 indicates the instance creation time on the Linux server of the RDS Service node.
    • mysqlinstance.info.log indicates the log type.

  2. Filter out the query result of the DB instance based on the steps provided as follows:

    1. Calculate the time difference between the Linux server of the RDSService node and the machine on which your use your browser.
    2. Based on the time difference, calculate the time on the RDSService node when the instance was created. Assume that the instance creation time on the browser is 20:20:58, and the time on the RDSService node is eight hours earlier than the time on the browser. Then the instance creation time on the RDSService node is 12:20:58.
    3. Among the query results obtained in 1, select the result closest to the time calculated in 2.b as the query result of the target instance.

How Do I Connect to a DB Instance Using the SSH Command?

Preparations
  1. Ensure the DB instance is available.
  2. Ensure GaussDB is available.
  3. Obtain the floating IP address of GaussDB from the engineering deployment document.
  4. Ensure the AESTool.jar tool is available.
Procedure
  1. Log in to the RDSService node, switch to user rds, connect to gsql, and switch to the corresponding database. Query the DB instance to be logged in based on the node ID, retrieve values of SSH_MGNT_PK, INTERNAL_VXLAN_IP, SSH_MGNT_PPH fields, and export the field values to the corresponding file. You can give any name to the imported file and put it wherever you like. Ensure the file name is simple and intelligible. 67c3c5b61d97419292d1402045fe841fno01 indicates the node ID.

    [rds@service2 ~]$ gsql -dnewmysqltest -h172.xxx.xxx.xxx -Ugaussdba -p5432 -Wgaussdb@123 -c "select SSH_MGNT_PK from DBS_NODE where ID='67c3c5b61d97419292d1402045fe841fno01';" >67c3c5b61d97419292d1402045fe841fno01.xxx 2>/dev/null
    [rds@service2 ~]$ set -i -e '3!d' -e "s/\s*\(\w*\)\s*/\1/" 67c3c5b61d97419292d14020445fe841fno01.xxx
    [rds@service2 ~]$ gsql -dnewmysqltest -h172.xxx.xxx.xxx -Ugaussdba -p5432 -Wgaussdb@123 -c "select INTERNAL_VXLAN_IP from DBS_NIC where ID=(select TARGET_ENTITY_ID from DBS_RELATIONSHIP where SOURCE_ENTITY_ID='67c3c5b61d97419292d1402045fe841fno01' and TYPE_ID='REALTION-TYPE-002');" >67c3c5b61d97419292d1402045fe841fno01_xxxmanageIP.txt 2>/dev/null
    [rds@service2 ~]$ set -i -e '3!d' -e "s/\s*\(\w*\)\s*/\1/" 67c3c5b61d97419292d14020445fe841fno01_xxxmanageIP.txt
    [rds@service2 ~]$ gsql -dnewmysqltest -h172.xxx.xxx.xxx -Ugaussdba -p5432 -Wgaussdb@123 -c "select SSH_MGNT_PPH from DBS_NODE where ID='67c3c5b61d97419292d1402045fe841fno01';" >67c3c5b61d97419292d1402045fe841fno01_xxxmngPPh.txt 2>/dev/null
    [rds@service2 ~]$ set -i -e '3!d' -e "s/\s*\(\w*\)\s*/\1/" 67c3c5b61d97419292d14020445fe841fno01_xxxmngPPh.txt
    NOTE:
    • -h indicates the floating database IP address. Set it based on site requirements.
    • -p indicates the port.
    • -U indicates the user name for remote connection.
    • -W indicates the password for remote connection.
    • -d indicates the database name and must be changed based on the actual situation.
    • -c indicates the query statement.

  2. Use the AESTool.jar tool to decrypt SSH_MGNT_PK and SSH_MGNT_PPH and save the decryption result for later use.

    NOTE:
    1. Encrypted private key SSH_MGNT_PK is saved in the file (instance_key, for example) exported in step 1. Use AESTool.jar to decrypt :4 instance_key. The decryption result will be saved in the instance_key_decrypt file that is automatically generated. The decryption method of SSH_MGNT_PPH (the value of the ciphertext) is the same as that of SSH_MGNT_PK. You can query the decrypted content in the corresponding file.
    2. For details about how to obtain and use the AESTool.jar tool, contact technical support for assistance.

  3. Run the SSH command to log in to the instance using the SSH_MGNT_PPH and SSH_MGNT_PK decrypted in Step 2 and the decrypted INTERNAL_VXLAN_IP.

    ssh -i 67c3c5b61d97419292d1402045fe841fno01_decrypt.xxx -o StrictHostKeyChecking=no -o UserKnownHosetsFile=/dev/null Mike@100.64.1.211
    NOTE:
    1. 100.64.1.211 indicates the INTERNAL_VXLAN_IP of the DB instance.
    2. 67c3c5b61d97419292d1402045fe841fno01_decrypt.xxx indicates the saved file after SSH_MGNT_PK is decrypted.

How Do I Use udstool.jar to Print Logs in a MySQL DB Instance?

Procedure
  1. Connect to the instance by following the instructions provided in How Do I Connect to a DB Instance Using the SSH Command?
  2. Update log4j.properties in udstool.jar. Run the following commands one by one.

    1. Switch to user ruby, and create the udstool directory in the /home/Ruby/bin directory.
      Copy udstool.jar from /home/Ruby/bin to /home/Ruby/bin/udstool and decompress it.
      [Mike@rds-oc-01 ~]$ su - Ruby
      [Ruby@rds-oc-01 ~]$ cd /home/Ruby/bin
      [Ruby@rds-oc-01 bin]$ mkdir udstool
      [Ruby@rds-oc-01 bin]$ cp udstool.jar udstool
      [Ruby@rds-oc-01 bin]$ cd udstool
      [Ruby@rds-oc-01 udstool]$ jar xvf udstool.jar
    2. Replace the content of log4j.properties with the following content:
      # default properties to initialize log4j
      log4j.rootLogger=info,console
      ############################################
      #Console appender
      ############################################
      log4j.appender.console=org.apache.log4j.ConsoleAppender
      log4j.appender.console.layout=org.apache.log4j.PatternLayout
      log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%p|%c{1}|%m%n
      
      #north interface log
      log4j.logger.com.huawei.mos.services.MosService=info,iAppender
      log4j.appender.iAppender=org.apache.log4j.RollingFileAppender
      log4j.appender.iAppender.file=/home/Ruby/bin/logs/OBS-SDK.interface.log
      log4j.appender.iAppender.encoding=UTF-8
      log4j.appender.iAppender.MaxFileSize=10MB
      log4j.appender.iAppender.MaxBackupIndex=50
      log4j.appender.iAppender.layout=org.apache.log4j.PatternLayout
      log4j.appender.iAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%p|%m%n
      
      #south interface log
      log4j.logger.org.jets3t.service.impl.rest.httpclient.RestStorageService.ilog=off,iAppender2
      log4j.appender.iAppender2=org.apache.log4j.RollingFileAppender
      log4j.appender.iAppender2.file=/home/Ruby/bin/logs/OBS-SDK.interface.log
      log4j.appender.iAppender2.encoding=UTF-8
      log4j.appender.iAppender2.MaxFileSize=10MB
      log4j.appender.iAppender2.MaxBackupIndex=50
      log4j.appender.iAppender2.layout=org.apache.log4j.PatternLayout
      log4j.appender.iAppender2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%p|%m%n
      
      #running log
      log4j.logger.com.huawei.mos.log.RunningLog=info,rAppender
      log4j.appender.rAppender=org.apache.log4j.RollingFileAppender
      log4j.appender.rAppender.file=/home/Ruby/bin/logs/OBS-SDK.run.log
      log4j.appender.rAppender.encoding=UTF-8
      log4j.appender.rAppender.MaxFileSize=10MB
      log4j.appender.rAppender.MaxBackupIndex=50
      log4j.appender.rAppender.layout=org.apache.log4j.PatternLayout
      log4j.appender.rAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%m%n
      
      log4j.logger.org.apache.http=WARN
      log4j.logger.org.apache.http.wire=WARN
      log4j.logger.org.apache.http.headers=WARN
      
      log4j.logger.org.jets3t=ERROR
      log4j.logger.org.jets3t.service=WARN
      log4j.logger.org.jets3t.service.Jets3tProperties=WARN
      log4j.logger.org.jets3t.service.utils=WARN
      log4j.logger.org.jets3t.service.utils.Mimetypes=WARN
      log4j.logger.org.jets3t.servlets=WARN
    3. Copy the modified log4j.properties to the /home/Ruby/bin/ directory.

      In the /home/Ruby/bin/ directory, back up the original udstool.jar file as udstool.jar.org.

      [Ruby@rds-oc-01 udstool]$ cp log4j.properties /home/Ruby/bin/
      [Ruby@rds-oc-01 udstool]$ cd /home/Ruby/bin
      [Ruby@rds-oc-01 bin]$ cp udstool.jar udstool.jar.org
    4. Update log4j.properties in udstool.jar and change the permission for udstool.jar to 500.
      [Ruby@rds-oc-01 bin]$ jar uf udstool.jar log4j.properties
      [Ruby@rds-oc-01 bin]$ chmod 500 udstool.jar

  3. After the test is complete, delete temporary files.

    [Ruby@rds-oc-01 bin]$ mv udstool.jar.org udstool.jar
    [Ruby@rds-oc-01 bin]$ rm -rf /home/Ruby/bin/udstool
    NOTE:

    The log paths of udstool.jar are as follows:

    /home/Ruby/bin/logs/OBS-SDK.interface.log

    /home/Ruby/bin/logs/OBS-SDK.run.log

How Do I Use obstool.jar to Print Logs in a PostgreSQL DB Instance?

Procedure
  1. Connect to the instance by following the instructions provided in How Do I Connect to a DB Instance Using the SSH Command?.
  2. Update log4j.properties in obstool.jar. Run the following commands one by one.

    1. Switch to user ruby, and create the obstool directory in the /home/Ruby/bin directory.
      Copy obstool.jar from /home/Ruby/bin to /home/Ruby/bin/obstool and decompress it.
      [Mike@rds-oc-01 ~]$ su - Ruby
      [Ruby@rds-oc-01 ~]$ cd /home/Ruby/bin
      [Ruby@rds-oc-01 bin]$ mkdir obstool
      [Ruby@rds-oc-01 bin]$ cp obstool.jar obstool
      [Ruby@rds-oc-01 bin]$ cd obstool
      [Ruby@rds-oc-01 obstool]$ jar xvf obstool.jar
    2. Replace the content of log4j.properties with the following content:
      # default properties to initialize log4j
      log4j.rootLogger=info,console
      ############################################
      #Console appender
      ############################################
      log4j.appender.console=org.apache.log4j.ConsoleAppender
      log4j.appender.console.layout=org.apache.log4j.PatternLayout
      log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%p|%c{1}|%m%n
      
      #north interface log
      log4j.logger.com.huawei.mos.services.MosService=info,iAppender
      log4j.appender.iAppender=org.apache.log4j.RollingFileAppender
      log4j.appender.iAppender.file=/home/Ruby/bin/logs/OBS-SDK.interface.log
      log4j.appender.iAppender.encoding=UTF-8
      log4j.appender.iAppender.MaxFileSize=10MB
      log4j.appender.iAppender.MaxBackupIndex=50
      log4j.appender.iAppender.layout=org.apache.log4j.PatternLayout
      log4j.appender.iAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%p|%m%n
      
      #south interface log
      log4j.logger.org.jets3t.service.impl.rest.httpclient.RestStorageService.ilog=off,iAppender2
      log4j.appender.iAppender2=org.apache.log4j.RollingFileAppender
      log4j.appender.iAppender2.file=/home/Ruby/bin/logs/OBS-SDK.interface.log
      log4j.appender.iAppender2.encoding=UTF-8
      log4j.appender.iAppender2.MaxFileSize=10MB
      log4j.appender.iAppender2.MaxBackupIndex=50
      log4j.appender.iAppender2.layout=org.apache.log4j.PatternLayout
      log4j.appender.iAppender2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%p|%m%n
      
      #running log
      log4j.logger.com.huawei.mos.log.RunningLog=info,rAppender
      log4j.appender.rAppender=org.apache.log4j.RollingFileAppender
      log4j.appender.rAppender.file=/home/Ruby/bin/logs/OBS-SDK.run.log
      log4j.appender.rAppender.encoding=UTF-8
      log4j.appender.rAppender.MaxFileSize=10MB
      log4j.appender.rAppender.MaxBackupIndex=50
      log4j.appender.rAppender.layout=org.apache.log4j.PatternLayout
      log4j.appender.rAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%m%n
      
      log4j.logger.org.apache.http=WARN
      log4j.logger.org.apache.http.wire=WARN
      log4j.logger.org.apache.http.headers=WARN
      
      log4j.logger.org.jets3t=ERROR
      log4j.logger.org.jets3t.service=WARN
      log4j.logger.org.jets3t.service.Jets3tProperties=WARN
      log4j.logger.org.jets3t.service.utils=WARN
      log4j.logger.org.jets3t.service.utils.Mimetypes=WARN
      log4j.logger.org.jets3t.servlets=WARN
    3. Copy the modified log4j.properties to the /home/Ruby/bin/ directory.

      In the /home/Ruby/bin/ directory, back up the original obstool.jar file as obstool.jar.org.

      [Ruby@rds-oc-01 obstool]$ cp log4j.properties /home/Ruby/bin/
      [Ruby@rds-oc-01 obstool]$ cd /home/Ruby/bin
      [Ruby@rds-oc-01 bin]$ cp obstool.jar obstool.jar.org
    4. Update log4j.properties in obstool.jar and change the permission for obstool.jar to 500.
      [Ruby@rds-oc-01 bin]$ jar uf obstool.jar log4j.properties
      [Ruby@rds-oc-01 bin]$ chmod 500 obstool.jar

  3. After the test is complete, delete temporary files.

    [Ruby@rds-oc-01 bin]$ mv obstool.jar.org obstool.jar
    [Ruby@rds-oc-01 bin]$ rm -rf /home/Ruby/bin/obstool
    NOTE:

    The log paths of obstool.jar are as follows:

    /home/Ruby/bin/logs/OBS-SDK.interface.log

    /home/Ruby/bin/logs/OBS-SDK.run.log

SQLSTATE[42000] Reported When Using DDL to Create a Table on MySQL 5.6

Symptom

When a user runs DDL statements to create a table on MySQL 5.6.x, the following error is displayed:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

The DDL statements used by the user are as follows:

CREATE TABLE access_token(id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NUL L, client_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL,expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL,UNIQUE INDEX UNIQ_B6A2DD685F37A13B (token), INDEX IDX_B6A2DD68A76ED395 (user_id), INDEX IDX_B6A2DD6819EB6921 (client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB';
Possible Causes

MySQL 5.6 allows a maximum of 767 bytes to be indexed.

  • If a user uses double-byte character code, such as GBK, a maximum of 383 (767/2) characters can be indexed.
  • If a user uses triple-byte character code, such as UTF8, a maximum of 255 (767/3) characters can be indexed.
  • If a user uses four-byte character code, such as UTF8mb4, a maximum of 191 (767/4) characters can be indexed.

The user uses utf8mb4, which allows a maximum of 191 characters to be indexed.

Solution 1

Use the prefix index to ensure only 191 characters are indexed.

Example:

CREATE TABLE access_token
(id INT AUTO_INCREMENT NOT NULL, 
user_id INT DEFAULT NULL, 
client_id INT DEFAULT NULL, 
token VARCHAR(255) NOT NULL,
expires_at INT DEFAULT NULL, 
scope VARCHAR(255) DEFAULT NULL,
UNIQUE INDEX UNIQ_B6A2DD685F37A13B (token(191)), 
INDEX IDX_B6A2DD68A76ED395 (user_id), 
INDEX IDX_B6A2DD6819EB6921 (client_id), 
PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB;
Solution 2

Use a small-byte character set, such as UTF8.

Example:

CREATE TABLE access_token
(id INT AUTO_INCREMENT NOT NULL, 
user_id INT DEFAULT NULL, 
client_id INT DEFAULT NULL, 
token VARCHAR(255) NOT NULL,
expires_at INT DEFAULT NULL, 
scope VARCHAR(255) DEFAULT NULL,
UNIQUE INDEX UNIQ_B6A2DD685F37A13B (token), 
INDEX IDX_B6A2DD68A76ED395 (user_id), 
INDEX IDX_B6A2DD6819EB6921 (client_id), 
PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ENGINE = InnoDB;

Index field restrictions:

MySQL 5.6 allows a maximum of 767 bytes to be indexed.

  • For a double-byte character set, such as GBK, a maximum of 383 (767/2) can be indexed.
    mysql>create table t(name varchar(384),key idx_name(name))DEFAULT CHARACTER SET GBK;
    ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
    mysql>create table t(name varchar(383),key idx_name(name))DEFAULT CHARACTER SET GBK;
    Query OK, 0 rows affected (0.02 sec)
  • For a triple-byte character set, such as utf8, a maximum of 255 (767/3) can be indexed.
    mysql>create table t(name varchar(256),key idx_name(name))DEFAULT CHARACTER SET UTF8;
    ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
    mysql> create table t(name varchar(255),key idx_name(name))DEFAULT CHARACTER SET UTF8;
    Query OK, 0 rows affected (0.02 sec)
  • For a four-byte character set, such as utf8mb4, a maximum of 191 (767/4) can be indexed.
    mysql> create table t(name varchar(192),key idx_name(name))DEFAULT CHARACTER SET UTF8mb4;
    ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
    mysql> create table t(name varchar(191),key idx_name(name))DEFAULT CHARACTER SET UTF8mb4;
    Query OK, 0 rows affected (0.03 sec)

MySQL 5.7 allows a maximum of 3072 bytes to be indexed.

  • For a double-byte character set, such as GBK, a maximum of 1536 (3072/2) can be indexed.
    mysql> create table t(name varchar(1537),key idx_name(name))DEFAULT CHARACTER SET GBK;
    ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
    mysql> create table t(name varchar(1536),key idx_name(name))DEFAULT CHARACTER SET GBK;
    Query OK, 0 rows affected (0.02 sec)
  • For a triple-byte character set, such as utf8, a maximum of 1024 (3072/3) can be indexed.
    mysql> create table t(name varchar(1025),key idx_name(name))DEFAULT CHARACTER SET UTF8;
    ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
    mysql> create table t(name varchar(1024),key idx_name(name))DEFAULT CHARACTER SET UTF8;
    Query OK, 0 rows affected (0.02 sec)
  • For a four-byte character set, such as utf8mb4, a maximum of 768 (3072/4) can be indexed.
    mysql> create table t(name varchar(769),key idx_name(name))DEFAULT CHARACTER SET UTF8mb4;
    ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
    mysql> create table t(name varchar(768),key idx_name(name))DEFAULT CHARACTER SET UTF8mb4;
    Query OK, 0 rows affected (0.02 sec)
Translation
Download
Updated: 2019-06-10

Document ID: EDOC1100063248

Views: 22595

Downloads: 37

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next