日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Mycat启动出现的报错字段及解决方法

發布時間:2023/12/20 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mycat启动出现的报错字段及解决方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Mycat報錯案例

案例一

  • Unable to start JVM: No such file or directory出現找不到或開啟不了JVM報錯時,其實就是程序在$PATH相對路徑下找不到java的啟動路徑
  • #報錯開啟不了JVM [root@localhost bin]# tail -fn 20 /usr/local/mycat/logs/wrapper.log STATUS | wrapper | 2022/12/09 11:39:10 | --> Wrapper Started as Daemon STATUS | wrapper | 2022/12/09 11:39:10 | Launching a JVM... ERROR | wrapper | 2022/12/09 11:39:10 | Unable to start JVM: No such file or directory (2) ERROR | wrapper | 2022/12/09 11:39:10 | JVM exited while loading the application. STATUS | wrapper | 2022/12/09 11:39:15 | Launching a JVM... ERROR | wrapper | 2022/12/09 11:39:15 | Unable to start JVM: No such file or directory (2) ERROR | wrapper | 2022/12/09 11:39:15 | JVM exited while loading the application. STATUS | wrapper | 2022/12/09 11:39:19 | Launching a JVM... ERROR | wrapper | 2022/12/09 11:39:19 | Unable to start JVM: No such file or directory (2) ERROR | wrapper | 2022/12/09 11:39:19 | JVM exited while loading the application. STATUS | wrapper | 2022/12/09 11:39:23 | Launching a JVM... ERROR | wrapper | 2022/12/09 11:39:23 | Unable to start JVM: No such file or directory (2) ERROR | wrapper | 2022/12/09 11:39:23 | JVM exited while loading the application. STATUS | wrapper | 2022/12/09 11:39:27 | Launching a JVM... ERROR | wrapper | 2022/12/09 11:39:27 | Unable to start JVM: No such file or directory (2) ERROR | wrapper | 2022/12/09 11:39:27 | JVM exited while loading the application. FATAL | wrapper | 2022/12/09 11:39:27 | There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up. FATAL | wrapper | 2022/12/09 11:39:27 | There may be a configuration problem: please check the logs. STATUS | wrapper | 2022/12/09 11:39:27 | <-- Wrapper Stopped#在$PATH下沒有java相對路徑 [root@localhost bin]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin [root@localhost bin]# [root@localhost bin]# /usr/java/jdk1.8.0_131/bin/java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) [root@localhost bin]# #把路徑添加到PATH [root@localhost bin]# export PATH=$PATH:/usr/java/jdk1.8.0_131/bin [root@localhost bin]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.8.0_131/bin [root@localhost bin]#

    案例二

  • Caused by: java.net.ConnectException: 拒絕連接 (Connection refused) 因Mycat剛部署完成不知道哪個是Master哪個是Slave所以出現這個報錯。
  • 所以需要修改Mycat的datasource目錄下的配置文件,需要指定主庫創建并授權的用戶、密碼、主從庫的IP地址、端口、原型數據庫、實例類型才能連接到主從庫中
  • [root@localhost bin]# tail -fn 20 /usr/local/mycat/logs/wrapper.log INFO | jvm 1 | 2022/12/09 12:11:09 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.NativeSession.connect(NativeSession.java:144) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:847) INFO | jvm 1 | 2022/12/09 12:11:09 | ... 7 common frames omitted INFO | jvm 1 | 2022/12/09 12:11:09 | Caused by: java.net.ConnectException: 拒絕連接 (Connection refused) INFO | jvm 1 | 2022/12/09 12:11:09 | at java.net.PlainSocketImpl.socketConnect(Native Method) INFO | jvm 1 | 2022/12/09 12:11:09 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) INFO | jvm 1 | 2022/12/09 12:11:09 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) INFO | jvm 1 | 2022/12/09 12:11:09 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) INFO | jvm 1 | 2022/12/09 12:11:09 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) INFO | jvm 1 | 2022/12/09 12:11:09 | at java.net.Socket.connect(Socket.java:589) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) INFO | jvm 1 | 2022/12/09 12:11:09 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) INFO | jvm 1 | 2022/12/09 12:11:09 | ... 9 common frames omitted STATUS | wrapper | 2022/12/09 12:11:10 | <-- Wrapper Stopped

    案例三

    [ERROR]com.alibaba.druid.pool.D
    ruidDataSource.run:2803create connection SQLException, url: jdbc:mysql://192.168.100.112/mycat?s
    erverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, errorCod

  • 以上報錯字段因MySQL主庫中的root用戶授權是localhost導致的 ,把在主庫中把root用戶的授權由localhost改為 ‘%’ ;mycat才能通過root賬號連上MySQL
  • [root@localhost logs]# more wrapper.log STATUS | wrapper | 2022/12/09 17:09:23 | --> Wrapper Started as Daemon STATUS | wrapper | 2022/12/09 17:09:23 | Launching a JVM... INFO | jvm 1 | 2022/12/09 17:09:23 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware. org INFO | jvm 1 | 2022/12/09 17:09:23 | Copyright 1999-2006 Tanuki Software, Inc. All Right s Reserved. INFO | jvm 1 | 2022/12/09 17:09:23 | INFO | jvm 1 | 2022/12/09 17:09:24 | path:/usr/local/mycat/./conf INFO | jvm 1 | 2022/12/09 17:09:24 | 2022-12-09 17:09:24,409[INFO]com.alibaba.druid.pool.Dr uidDataSource.init:990{dataSource-1} inited INFO | jvm 1 | 2022/12/09 17:09:27 | 2022-12-09 17:09:27,418[WARN]com.alibaba.druid.pool.Dr uidDataSource.getConnectionDirect:1424get connection timeout retry : 1 INFO | jvm 1 | 2022/12/09 17:09:28 | 2022-12-09 17:09:28,612[ERROR]com.alibaba.druid.pool.D ruidDataSource.run:2803create connection SQLException, url: jdbc:mysql://192.168.100.112/mycat?s erverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, errorCod e 0, state 08001 INFO | jvm 1 | 2022/12/09 17:09:28 | java.sql.SQLNonTransientConnectionException: Could notcreate connection to database server. Attempted reconnect 3 times. Giving up. INFO | jvm 1 | 2022/12/09 17:09:28 | at com.mysql.cj.jdbc.exceptions.SQLError.createS QLException(SQLError.java:110) mysql> update mysql.user set host='%' where user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql> mysql> select user,host from mysql.user where user='root'\G *************************** 1. row *************************** user: root host: % 1 row in set (0.12 sec)mysql>

    案例四

    cn.mycat.vertx.xa.impl.Xa
    LogImpl.?:?java.sql.SQLException: XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency

  • 以上報錯表示連接數據庫的用戶沒有xa_recover_admin權限。
  • 在數據庫中對該用戶重新授權即可
  • [root@localhost logs]# more wrapper.log STATUS | wrapper | 2022/12/09 17:27:41 | --> Wrapper Started as Daemon STATUS | wrapper | 2022/12/09 17:27:42 | Launching a JVM... INFO | jvm 1 | 2022/12/09 17:27:42 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware. org INFO | jvm 1 | 2022/12/09 17:27:42 | Copyright 1999-2006 Tanuki Software, Inc. All Right s Reserved. INFO | jvm 1 | 2022/12/09 17:27:42 | INFO | jvm 1 | 2022/12/09 17:27:42 | path:/usr/local/mycat/./conf INFO | jvm 1 | 2022/12/09 17:27:43 | 2022-12-09 17:27:43,093[INFO]com.alibaba.druid.pool.Dr uidDataSource.init:990{dataSource-1} inited INFO | jvm 1 | 2022/12/09 17:27:43 | 2022-12-09 17:27:43,350[INFO]com.alibaba.druid.pool.Dr uidDataSource.init:990{dataSource-2} inited INFO | jvm 1 | 2022/12/09 17:27:44 | 2022-12-09 17:27:44,116[INFO]io.mycat.config.MycatRout erConfigOps.recoveryXA:735readXARecoveryLog start INFO | jvm 1 | 2022/12/09 17:27:44 | 2022-12-09 17:27:44,223[WARN]cn.mycat.vertx.xa.impl.Xa LogImpl.?:?java.sql.SQLException: XAER_RMERR: Fatal error occurred in the transaction branch - c heck your data for consistency INFO | jvm 1 | 2022/12/09 17:27:44 | 2022-12-09 17:27:44,225[WARN]cn.mycat.vertx.xa.impl.Xa LogImpl.?:?java.sql.SQLException: XAER_RMERR: Fatal error occurred in the transaction branch - c heck your data for consistency INFO | jvm 1 | 2022/12/09 17:27:44 | 2022-12-09 17:27:44,250[INFO]io.mycat.vertx.VertxMycat Server.lambda$start$1:166Mycat Vertx server 2b4f2ad8-9919-4acf-b2ec-95accaf340e9 started up. INFO | jvm 1 | 2022/12/09 17:27:44 | 2022-12-09 17:27:44,250[INFO]io.mycat.vertx.VertxMycat Server.lambda$start$1:166Mycat Vertx server 11588fd2-fd63-4719-8c3f-392c99aea303 started up.

    案例五

  • 當在主庫創建數據庫、表和插入數據后,從庫可以同步,但在客戶端無法查看表內數據庫;可正常查看表格式
  • 出現這種情況可以通過重啟mycat服務解決
  • mysql> select * from t1; ERROR: org.apache.calcite.runtime.CalciteContextException: At line 0, column 0: Object 't1' not found within 'discuz' mysql> mysql> use discuz; Database changed mysql> desc t1; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | id | int | YES | | NULL | | | name | varchar(20) | YES | | NULL | | | job | char(20) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ 3 rows in set (0.03 sec)mysql>[root@localhost logs]# /usr/local/mycat/bin/mycat restart Stopping mycat2... Stopped mycat2. Starting mycat2... [root@localhost logs]# [root@sunlit5 ~]# mysql -h 192.168.100.111 -uroot -pAdmin@123 -P 8066 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 0 Server version: 5.7.33-mycat-2.0 MySQL Community Server - GPLCopyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases; +--------------------+ | `Database` | +--------------------+ | discuz | | information_schema | | mysql | | performance_schema | +--------------------+ 4 rows in set (0.05 sec)mysql> use discuz; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> select * from t1; +------+----------+------+ | id | name | job | +------+----------+------+ | 1 | xiaoming | IT | | 2 | xiaowang | IT | +------+----------+------+ 2 rows in set (0.02 sec)mysql>

    案例六

    [ERROR]com.alibaba.druid.pool.DruidDataSource.run:2803create connection SQLException, url: jdbc:mysql://192.168.100.112:3306/myca
    t?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, errorCode 0, state 08001

  • 當mycat啟動時出現該報錯,表示MySQL中的時區與mycat的時區不一致,需要在MySQL中設置時區
  • 時區設置完后,重啟mycat即可
  • [root@localhost logs]# more wrapper.log STATUS | wrapper | 2022/12/10 23:52:06 | --> Wrapper Started as Daemon STATUS | wrapper | 2022/12/10 23:52:06 | Launching a JVM... INFO | jvm 1 | 2022/12/10 23:52:07 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org INFO | jvm 1 | 2022/12/10 23:52:07 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved. INFO | jvm 1 | 2022/12/10 23:52:07 | INFO | jvm 1 | 2022/12/10 23:52:07 | path:/usr/local/mycat/./conf INFO | jvm 1 | 2022/12/10 23:52:07 | 2022-12-10 23:52:07,788[INFO]com.alibaba.druid.pool.DruidDataSource.init:990{dataSource-1} inited INFO | jvm 1 | 2022/12/10 23:52:10 | 2022-12-10 23:52:10,790[WARN]com.alibaba.druid.pool.DruidDataSource.getConnectionDirect:1424get connection timeout retry : 1 INFO | jvm 1 | 2022/12/10 23:52:12 | 2022-12-10 23:52:12,010[ERROR]com.alibaba.druid.pool.DruidDataSource.run:2803create connection SQLException, url: jdbc:mysql://192.168.100.112:3306/myca t?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, errorCode 0, state 08001 INFO | jvm 1 | 2022/12/10 23:52:12 | java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:903) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) INFO | jvm 1 | 2022/12/10 23:52:12 | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) mysql> set global time_zone='+8:00'; Query OK, 0 rows affected (0.00 sec)mysql> set time_zone='+8:00'; Query OK, 0 rows affected (0.00 sec)mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)mysql> select curtime(); +-----------+ | curtime() | +-----------+ | 10:42:51 | +-----------+ 1 row in set (0.00 sec)mysql>

    總結

    以上是生活随笔為你收集整理的Mycat启动出现的报错字段及解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。