内容纲要
现象
使用sql可以show tables获取数据库表信息,但是waterdrop点击数据库展开时报错,报错为system_link
中无法找到views_v
;
排查及修复
txsql中存放inceptor元数据,进入后发现确实缺失了views_v视图,怀疑为人工操作是删除
1.查看txsql的pod名称和节点
[root@amen01-7 ~]# kubectl get po -owide|grep txsql
txsql-server-txsql1-3329110420-868pb 1/1 Running 1 41d 172.22.39.9 amen03-9
txsql-server-txsql1-3329110420-bmwj7 1/1 Running 1 41d 172.22.39.7 amen01-7
txsql-server-txsql1-3329110420-zgjw5 1/1 Running 0 1d 172.22.39.8 amen02-8
[root@amen01-7 ~]#
2.从任意pod获取txsql主节点,修复从主节点登录txsql进行
[root@amen01-7 ~]# kubectl exec -it txsql-server-txsql1-3329110420-bmwj7 -c txsql-server-txsql1 -- /usr/bin/txsql/tools/txsql.sh list
get master 172.22.39.7 expire time 1581492299 Wed Feb 12 15:24:59 2020
ip 172.22.39.7 port 17000
ip 172.22.39.8 port 17000
ip 172.22.39.9 port 17000
3.主节点为172.22.39.7,登陆该节点的txsql
[root@amen01-7 ~]# kubectl exec -it txsql-server-txsql1-3329110420-bmwj7 -c txsql-server-txsql1 -- /usr/bin/txsql/tools/txsql.sh
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 939962
Server version: 5.6.31-77.0-log Source distribution
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
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>
4.对于本例,metastore_inceptor1
库中不存在视图view_v
,使用sql重建该视图:
CREATE ALGORITHM=UNDEFINED DEFINER=inceptoruser
@%
SQL SECURITY DEFINER VIEW views_v
AS select tbls
.TBL_ID
AS view_id
,tbls
.TBL_NAME
AS view_name
,DBS
.NAME
AS database_name
,from_unixtime(tbls
.CREATE_TIME
) AS create_time
,tbls
.VIEW_ORIGINAL_TEXT
AS origin_text
,tbls
.VIEW_EXPANDED_TEXT
AS expanded_text
,tbls
.OWNER
AS owner_name
from ((temp_view_v
tbls
join DBS
on((tbls
.DB_ID
= DBS
.DB_ID
))) join SDS
on((tbls
.SD_ID
= SDS
.SD_ID
)));
5.验证waterdrop程序能否正常展开数据库信息