【已解决/安装问题】私有云高可用安装 Rainbond 用外部数据库安装报错。

请完善如下信息,方便我们协助排查问题:
fatal: [bff40a42-78bd-3ce1-a87e-f059ee673d89]: FAILED! => {“attempts”: 5, “changed”: true, “cmd”: “bash /opt/rainbond/.init/updatedb.sh config >> /tmp/install/db.init.config.log”, “delta”: “0:01:02.849462”, “end”: “2019-11-09 17:49:41.581897”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2019-11-09 17:48:38.732435”, “stderr”: “ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1\nERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1\nERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1\nERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1\nERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1\nERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”, “stderr_lines”: [“ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”, “ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”, “ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”, “ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”, “ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”, “ERROR 1406 (22001) at line 1 in file: ‘/opt/rainbond/.init/region_info.sql’: Data too long for column ‘region_id’ at row 1”], “stdout”: “”, “stdout_lines”: []}
仅可能详细点
Rainbond版本: grctl version v5.1.8-release-d373329-2019-10-31-09
操作系统: ubuntu
内核版本:Linux rainbondmaster01 4.4.0-142-generic
环境:(云服务商,虚拟机等) 虚拟机
节点配置:
安装类型:私有云高可用安装 Rainbond
如何复现:安装时使用外部数据库部署
尝试解决: 手动修改region_id字段长度 32到36位 并导入region_info.sql数据库表
相关截图:
是否重新执行安装:

集群或应用问题额外需要提供如下信息:

  1. 集群是否正常(grctl node list)
  2. 应用是否正常 (grctl service get <应用别名> -t <租户>)
  3. 应用监听端口是否正确,是否开启了健康检测,持久化目录是否设置正确
  4. 集群状态
    正常
  5. 操作流程,能否复现
  6. 是否尝试过更新部分组件的镜像,是否有效
  7. 控制台报错或者异常请确定哪个接口报异常,F12

目前的问题是
集群UI 微服务端口无法打开对外服务
提示

journalctl -fu rbd-app-ui
Nov 11 09:58:01 rainbondmaster01 bash[2205]: 10.10.10.33 - - [11/Nov/2019:09:58:01 +0800] “PUT /console/teams/d7z1ga52/apps/gr7d218e/ports/8848 HTTP/1.1” 500 88 “http://10.10.10.48:7070/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36”

journalctl -fu rbd-gateway
– Logs begin at Sat 2019-11-09 17:25:06 CST. –
Nov 11 09:59:03 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:03+08:00” level=warning msg=“wrong endpoint: :8081”
Nov 11 09:59:04 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:04+08:00” level=warning msg=“wrong endpoint: :6442”
Nov 11 09:59:04 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:04+08:00” level=warning msg=“wrong endpoint: :5000”
Nov 11 09:59:04 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:04+08:00” level=warning msg=“wrong endpoint: :8081”
Nov 11 09:59:04 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:04+08:00” level=warning msg=“wrong endpoint: :6442”
Nov 11 09:59:04 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:04+08:00” level=warning msg=“wrong endpoint: :5000”
Nov 11 09:59:04 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:04+08:00” level=warning msg=“wrong endpoint: :8081”
Nov 11 09:59:05 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:05+08:00” level=warning msg=“wrong endpoint: :6442”
Nov 11 09:59:05 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:05+08:00” level=warning msg=“wrong endpoint: :5000”
Nov 11 09:59:05 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:05+08:00” level=warning msg=“wrong endpoint: :8081”
Nov 11 09:59:06 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:06+08:00” level=warning msg=“wrong endpoint: :6442”
Nov 11 09:59:06 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:06+08:00” level=warning msg=“wrong endpoint: :5000”
Nov 11 09:59:06 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:06+08:00” level=warning msg=“wrong endpoint: :8081”
Nov 11 09:59:06 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:06+08:00” level=warning msg=“wrong endpoint: :6442”
Nov 11 09:59:06 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:06+08:00” level=warning msg=“wrong endpoint: :5000”
Nov 11 09:59:06 rainbondmaster01 bash[10052]: time=“2019-11-11T09:59:06+08:00” level=warning msg=“wrong endpoint: :8081”

抄送: @barnett

当前问题看起来是对接外部数据库产生了错误,按照如下思路排查解决:

好的 那是我数据库版本的问题了。我换下数据库版本试试先。目前用的是5.7版本的

更换数据库后,按照如下方式,可以重新初始化数据库:
https://www.rainbond.com/docs/troubleshoot/concrete-operations/manual-init-db/

数据库换成5.6版本后还是异常。

2019-11-11 15:01:09 [ERROR] localhost [put] /app/ui/console/views/app_config/app_port.py:296 (1406, “Data too long for column ‘region_id’ at row 1”)
Traceback (most recent call last):
File “/app/ui/console/views/app_config/app_port.py”, line 290, in put
action, protocol, port_alias)
File “/app/ui/console/services/app_config/port_service.py”, line 276, in manage_port
code, msg = self.__open_outer(tenant, service, region, deal_port)
File “/app/ui/console/services/app_config/port_service.py”, line 316, in __open_outer
http_rule_id, tenant_id, service_alias, region_id)
File “/app/ui/console/repositories/app_config.py”, line 531, in create_service_domains
region_id=region_id)
File “/usr/local/lib/python2.7/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/django/db/models/query.py”, line 394, in create
obj.save(force_insert=True, using=self.db)
File “/usr/local/lib/python2.7/site-packages/django/db/models/base.py”, line 808, in save
force_update=force_update, update_fields=update_fields)
File “/usr/local/lib/python2.7/site-packages/django/db/models/base.py”, line 838, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File “/usr/local/lib/python2.7/site-packages/django/db/models/base.py”, line 924, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File “/usr/local/lib/python2.7/site-packages/django/db/models/base.py”, line 963, in _do_insert
using=using, raw=raw)
File “/usr/local/lib/python2.7/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/django/db/models/query.py”, line 1076, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File “/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py”, line 1107, in execute_sql
cursor.execute(sql, params)
File “/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py”, line 65, in execute
return self.cursor.execute(sql, params)
File “/usr/local/lib/python2.7/site-packages/django/db/utils.py”, line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File “/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py”, line 65, in execute
return self.cursor.execute(sql, params)
File “/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py”, line 101, in execute
return self.cursor.execute(query, args)
File “/usr/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
DataError: (1406, “Data too long for column ‘region_id’ at row 1”)

root@rainbondmaster01:/tmp# mkdir -p /tmp/install/
root@rainbondmaster01:/tmp# /opt/rainbond/.init/updatedb.sh prepare
db is ok
prepare ok
root@rainbondmaster01:/tmp# /opt/rainbond/.init/updatedb.sh migrate
File “./entrypoint.sh”, line 3
if [ “$1” = “debug” -o “$1” = “bash” ];then
^
SyntaxError: invalid syntax
root@rainbondmaster01:/tmp# /opt/rainbond/.init/updatedb.sh config
init config done
init config ok

数据库初始化也会出错。

查看这两个文件中的数据库连接地址是否正确,如果不正确,修改之后重新初始化数据库

cat /opt/rainbond/conf/ui.yaml |grep MYSQL

cat /opt/rainbond/conf/master.yaml |grep mysql

重新初始化数据库之前,是否降原有的 region console 库删除?

重新初始化后 又有新的报错。

Exception: 初始化权限数据错误:
2019-11-11 15:45:29 [ERROR] localhost [get] /app/ui/console/views/logos.py:83 初始化权限数据错误:
Traceback (most recent call last):
File “/app/ui/console/views/logos.py”, line 29, in get
status = role_perm_repo.initialize_permission_settings()
File “/usr/local/lib/python2.7/site-packages/django/utils/decorators.py”, line 185, in inner
return func(*args, **kwargs)
File “/app/ui/console/repositories/perm_repo.py”, line 671, in initialize_permission_settings
raise Exception(“初始化权限数据错误:{}”.format(e.message))
Exception: 初始化权限数据错误:

已经删除原有的数据库

数据库版本5.6.46

数据库的连接地址确保正确?当前用户对于两个数据库有读写权限?

可以初始化可以导入数据 用户给了root 超管的权限。但是region_info表无法正常导入。需要手动导入。

region-info导入时报什么错?

问题已解决。在使用Mysql 5.6 作为Rainbond外部数据库的时候,请不要限制 sql mode 为严格模式。
https://dev.mysql.com/doc/refman/5.6/en/sql-mode.html