Comments (11)
需要尝试复现,可能要久等一下
from polardbx-sql.
需要尝试复现,可能要久等一下
这个问题最初出现的错误是在 初始化的时候 , 上面提到的异常信息 ,是在附加其他操作才产生的。
bin/startup.sh
-I
-P asdf1234ghjk5678
-d 127.0.0.1:4886:32886
-r ""
-u polardbx_root
-S "123456"
Exception in thread "main" ERR-CODE: [PXC-10004][ERR_X_PROTOCOL_RESULT] Fatal error when fetch data: Unable to switch context to user root HY000
at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:926)
at com.alibaba.polardbx.rpc.result.XResult.waitFinish(XResult.java:508)
at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:567)
at com.alibaba.polardbx.rpc.result.XResult.waitFinish(XResult.java:508)
at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:567)
at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:551)
at com.alibaba.polardbx.rpc.result.XResult.finishBlockMode(XResult.java:159)
at com.alibaba.polardbx.rpc.client.XSession.execUpdate(XSession.java:1703)
at com.alibaba.polardbx.rpc.pool.XConnection.execUpdate(XConnection.java:281)
at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdateX(XStatement.java:55)
at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdate(XStatement.java:82)
at com.alibaba.polardbx.gms.metadb.MetaDbDataSource.initTsoServicesX(MetaDbDataSource.java:129)
at com.alibaba.polardbx.gms.metadb.MetaDbDataSource.initXDataSourceByJdbcProps(MetaDbDataSource.java:170)
at com.alibaba.polardbx.gms.metadb.MetaDbDataSource.initMetaDbDataSource(MetaDbDataSource.java:181)
at com.alibaba.polardbx.gms.metadb.MetaDbDataSource.doInit(MetaDbDataSource.java:121)
at com.alibaba.polardbx.common.model.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:43)
at com.alibaba.polardbx.gms.metadb.MetaDbDataSource.getInstance(MetaDbDataSource.java:462)
at com.alibaba.polardbx.server.TddlLauncher.initGms(TddlLauncher.java:229)
at com.alibaba.polardbx.server.TddlLauncher.main(TddlLauncher.java:69)
from polardbx-sql.
可能需要先排除第一次初始化引起的脏数据,是否可以把DN恢复到最初始的状态,然后重新用下列命令初始化看下
- mysql -h127.0.0.1 -P4886 -uroot -e "alter user 'root'@'localhost' identified by 'admin'"
- mysql -h127.0.0.1 -P4886 -uroot -padmin -e "create user 'root'@'%' identified by 'admin'"
- mysql -h127.0.0.1 -P4886 -uroot -padmin -e "grant all on . to 'root'@'%'
- bin/startup.sh -I -P asdf1234ghjk5678 -r "admin" -d 127.0.0.1:4886:32886 -u polardbx_root -S "123456"
from polardbx-sql.
可能需要先排除第一次初始化引起的脏数据,是否可以把DN恢复到最初始的状态,然后重新用下列命令初始化看下
- mysql -h127.0.0.1 -P4886 -uroot -e "alter user 'root'@'localhost' identified by 'admin'"
- mysql -h127.0.0.1 -P4886 -uroot -padmin -e "create user 'root'@'%' identified by 'admin'"
- mysql -h127.0.0.1 -P4886 -uroot -padmin -e "grant all on . to 'root'@'%'
- bin/startup.sh -I -P asdf1234ghjk5678 -r "admin" -d 127.0.0.1:4886:32886 -u polardbx_root -S "123456"
从堆栈和代码上看 是初始化的时候 执行 initTsoServicesX 方法的时候 报错了。
from polardbx-sql.
堆栈上看到了,initTsoServicesX 不是初始化的逻辑,是启动的逻辑
报错是说没找到leader for metadb storage, 怀疑读到了第一次初始化后的配置
from polardbx-sql.
polardbx
初始化DN和启动DN的时候 总是报警告(图片) , 可能与下面的错误有关
Exception in thread "main" ERR-CODE: [PXC-10004][ERR_X_PROTOCOL_RESULT] Fatal error when fetch data: Unable to switch context to user root HY000
from polardbx-sql.
这个报错不影响,loose参数是一个兼容特性,对于这个开头的参数如果不识别可以忽略掉,可以贴下mysqld的日志看看是否正常启动了
from polardbx-sql.
已复现
Unable to switch context to user root HY000
调整部分初始化命令后,启动成功:
下面是测试成功的环境信息:
OS Version: CentOS Linux release 7.8.2003 (Core)
Gcc Version: gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
修复方案如下:
先清空DN环境,我这边的方式是操作是将mysql的工作空间删除,重新启动。
DN:
DN指定mysqld启动后,增加了以下命令, 用于设置root密码为admin:
mysql -h127.0.0.1 -P4886 -uroot -e "alter user 'root'@'localhost' identified by 'admin'"
mysql -h127.0.0.1 -P4886 -uroot -padmin -e "create user 'root'@'%' identified by 'admin'"
mysql -h127.0.0.1 -P4886 -uroot -padmin -e "grant all on *.* to 'root'@'%'"
CN:
CN初始化脚本中 -r参数修改为"admin", 完整命令如下:
bin/startup.sh \
-I \
-P asdf1234ghjk5678 \
-d 127.0.0.1:4886:32886 \
-r "admin" \
-u polardbx_root \
-S "123456"
from polardbx-sql.
操作路径: 源码编译DN启动后 1 初始化 执行能够正常完成 bin/startup.sh -I -P asdf1234ghjk5678 -r "admin" -d 127.0.0.1:4886:32886 -u polardbx_root -S "123456" 2 把 metaDbPasswd=BVUB3NoOBdCXPv+X2Wa3es6Ng1tzChSd9Vzdm2RVaBo= 放到 conf/server.properties 3 启动 命令没有报错 bin/startup.sh -P asdf1234ghjk5678 4 连接数据库报错了,8527端口没有监听 mysql -h127.0.0.1 -P8527 -upolardbx_root -p123456 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
该问题也已复现,确认是因为初始化后失败后的脏数据引起的,根本原因是你下面的截图中的报错: "Fatal error when fetch data: Unable to switch context to user root HY000", 请参考上面的操作步骤重新启动
from polardbx-sql.
解决手法:
- 清空、重置 DN 环境
rm -rf ${MySQL_DATADIR}
mysqld --defaults-file=/home/polardb/data/mysql/mysql4886/my4886.cnf --initialize-insecure
mysql -h127.0.0.1 -P4886 -uroot -e "alter user 'root'@'localhost' identified by 'admin'"
mysql -h127.0.0.1 -P4886 -uroot -padmin -e "create user 'root'@'%' identified by 'admin'"
mysql -h127.0.0.1 -P4886 -uroot -padmin -e "grant all on *.* to 'root'@'%'"
or
drop user [email protected];
drop user my_polarx@localhost;
drop user my_polarx;
drop database polardbx_meta_db_polardbx;
DN 状态
- CN 初始化 & 启动
bin/startup.sh \
-I \
-P asdf1234ghjk5678 \
-d 127.0.0.1:4886:32886 \
-r "admin" \
-u polardbx_root \
-S "123456"
PS:初始化比较久,可在数据库中 show full processlist;
查看正在初始化
更新生成的 metaDbPasswd 至 conf/server.properties、启动 CN
bin/startup.sh -P asdf1234ghjk5678
- 验证 CN 启动成功
mysql -h127.1 -P8527 -upolardbx_root -p123456
操作步骤对比官方构建说明来看,之前失败原因疑似没有 root@%
用户,导致无法正常初始化。
from polardbx-sql.
解决手法:
- 清空、重置 DN 环境
rm -rf ${MySQL_DATADIR} mysqld --defaults-file=/home/polardb/data/mysql/mysql4886/my4886.cnf --initialize-insecure mysql -h127.0.0.1 -P4886 -uroot -e "alter user 'root'@'localhost' identified by 'admin'" mysql -h127.0.0.1 -P4886 -uroot -padmin -e "create user 'root'@'%' identified by 'admin'" mysql -h127.0.0.1 -P4886 -uroot -padmin -e "grant all on *.* to 'root'@'%'" or drop user [email protected]; drop user my_polarx@localhost; drop user my_polarx; drop database polardbx_meta_db_polardbx;
DN 状态
- CN 初始化 & 启动
bin/startup.sh \ -I \ -P asdf1234ghjk5678 \ -d 127.0.0.1:4886:32886 \ -r "admin" \ -u polardbx_root \ -S "123456"
PS:初始化比较久,可在数据库中
show full processlist;
查看正在初始化更新生成的 metaDbPasswd 至 conf/server.properties、启动 CN
bin/startup.sh -P asdf1234ghjk5678
- 验证 CN 启动成功
mysql -h127.1 -P8527 -upolardbx_root -p123456
操作步骤对比官方构建说明来看,之前失败原因疑似没有
root@%
用户,导致无法正常初始化。
非常感谢你的补充,对社区的用户非常有帮助
from polardbx-sql.
Related Issues (20)
- K8S operator webhook error x509: certificate is not valid for any names HOT 6
- [WeeklyReport] Weekly report for polardbx-sql 11/20/2023 to 11/27/2023
- [WeeklyReport] Weekly report for polardbx-sql 11/27/2023 to 12/4/2023
- [WeeklyReport] Weekly report for polardbx-sql 12/4/2023 to 12/11/2023
- [WeeklyReport] Weekly report for polardbx-sql 12/11/2023 to 12/18/2023
- [WeeklyReport] Weekly report for polardbx-sql 12/18/2023 to 12/25/2023
- [WeeklyReport] Weekly report for polardbx-sql 12/25/2023 to 1/1/2024
- [WeeklyReport] Weekly report for polardbx-sql 1/1/2024 to 1/8/2024
- Error from server (InternalError): error when creating "polardb-x.yaml": Internal error occurred: failed calling webhook "polardbxcluster-mutate.polardbx.aliyun.com": failed to call webhook: the server is currently unable to handle the request
- [WeeklyReport] Weekly report for polardbx-sql 1/8/2024 to 1/15/2024
- [WeeklyReport] Weekly report for polardbx-sql 1/15/2024 to 1/22/2024
- [WeeklyReport] Weekly report for polardbx-sql 1/22/2024 to 1/29/2024
- [WeeklyReport] Weekly report for polardbx-sql 1/29/2024 to 2/5/2024
- Windows 使用PXD安装PolarDB-X报 '--initialize-insecure']' returned non-zero exit status 1. HOT 14
- 银河麒麟v10启动报错
- FOREIGN KEY are not supported HOT 1
- cmake Compilation failed HOT 2
- CN不能正常启动 HOT 14
- polardbx-sql无法编译安装 HOT 1
- DN镜像安装密码问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polardbx-sql.