Ranger 2.1.0 Admin安装

个人博客地址:Ranger 2.1.0 Admin安装 | 一张假钞的真实世界

Creating MySQL user ranger2 failed

复制代码
2021-07-01 18:44:53,480  [E] Creating MySQL user ranger2 failed..
2021-07-01 18:44:53,496  [E] DB schema setup failed! Please contact Administrator.

原因是Ranger安装程序默认会使用MySQL的root账号创建所需要的账号,也就是DBA过程。如果不需要安装程序自动创建,则将install.properties中的以下配置前的#号去掉:

复制代码
setup_mode=SeparateDBA

Specified key was too long; max key length is 767 bytes

  • 第一种报错:

    Error executing: CREATE TABLE x_portal_user ( id bigint(20) NOT NULL AUTO_INCREMENT, create_time datetime DEFAULT NULL, update_time datetime DEFAULT NULL, added_by_id bigint(20) DEFAULT NULL, upd_by_id bigint(20) DEFAULT NULL, first_name varchar(1022) DEFAULT NULL, last_name varchar(1022) DEFAULT NULL, pub_scr_name varchar(2048) DEFAULT NULL, login_id varchar(767) DEFAULT NULL, password varchar(512) NOT NULL, email varchar(512) DEFAULT NULL, status int(11) NOT NULL DEFAULT '0', user_src int(11) NOT NULL DEFAULT '0', notes varchar(4000) DEFAULT NULL, other_attributes varchar(4000) DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY x_portal_user_UK_login_id (login_id), UNIQUE KEY x_portal_user_UK_email (email), KEY x_portal_user_FK_added_by_id (added_by_id), KEY x_portal_user_FK_upd_by_id (upd_by_id), KEY x_portal_user_cr_time (create_time), KEY x_portal_user_up_time (update_time), KEY x_portal_user_name (first_name(767)), KEY x_portal_user_email (email), CONSTRAINT x_portal_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id), CONSTRAINT x_portal_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCESx_portal_user (id) ) ROW_FORMAT=DYNAMIC;
    java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
    SQLException : SQL state: 42000 java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes ErrorCode: 1071
    2021-07-02 10:44:54,411 [E] ranger_core_db_mysql.sql file import failed!

修改对应字段的长度可以解决。注意UTF8每个字符4个字节。

  • 第二种报错:

    Error executing: CREATE TABLE x_portal_user ( id bigint(20) NOT NULL AUTO_INCREMENT, create_time datetime DEFAULT NULL, update_time datetime DEFAULT NULL, added_by_id bigint(20) DEFAULT NULL, upd_by_id bigint(20) DEFAULT NULL, first_name varchar(128) DEFAULT NULL, last_name varchar(1022) DEFAULT NULL, pub_scr_name varchar(2048) DEFAULT NULL, login_id varchar(128) DEFAULT NULL, password varchar(512) NOT NULL, email varchar(128) DEFAULT NULL, status int(11) NOT NULL DEFAULT '0', user_src int(11) NOT NULL DEFAULT '0', notes varchar(4000) DEFAULT NULL, other_attributes varchar(4000) DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY x_portal_user_UK_login_id (login_id), UNIQUE KEY x_portal_user_UK_email (email), KEY x_portal_user_FK_added_by_id (added_by_id), KEY x_portal_user_FK_upd_by_id (upd_by_id), KEY x_portal_user_cr_time (create_time), KEY x_portal_user_up_time (update_time), KEY x_portal_user_name (first_name(767)), KEY x_portal_user_email (email), CONSTRAINT x_portal_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES x_portal_user (id), CONSTRAINT x_portal_user_FK_upd_by_id FOREIGN KEY (upd_by_id) REFERENCES x_portal_user (id) ) ROW_FORMAT=DYNAMIC;
    java.sql.SQLException: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
    SQLException : SQL state: HY000 java.sql.SQLException: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys ErrorCode: 1089
    2021-07-02 11:51:23,763 [E] ranger_core_db_mysql.sql file import failed!

去掉prefix key的定义即可。

修改后的建表语句如下:

复制代码
CREATE TABLE `x_portal_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `create_time` datetime DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  `added_by_id` bigint(20) DEFAULT NULL,
  `upd_by_id` bigint(20) DEFAULT NULL,
  `first_name` varchar(128) DEFAULT NULL,
  `last_name` varchar(1022) DEFAULT NULL,
  `pub_scr_name` varchar(2048) DEFAULT NULL,
  `login_id` varchar(128) DEFAULT NULL,
  `password` varchar(512) NOT NULL,
  `email` varchar(128) DEFAULT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `user_src` int(11) NOT NULL DEFAULT '0',
  `notes` varchar(4000) DEFAULT NULL,
  `other_attributes` varchar(4000) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
  UNIQUE KEY `x_portal_user_UK_email` (`email`),
  KEY `x_portal_user_FK_added_by_id` (`added_by_id`),
  KEY `x_portal_user_FK_upd_by_id` (`upd_by_id`),
  KEY `x_portal_user_cr_time` (`create_time`),
  KEY `x_portal_user_up_time` (`update_time`),
  KEY `x_portal_user_name` (`first_name`),
  KEY `x_portal_user_email` (`email`),
  CONSTRAINT `x_portal_user_FK_added_by_id` FOREIGN KEY (`added_by_id`) REFERENCES `x_portal_user` (`id`),
  CONSTRAINT `x_portal_user_FK_upd_by_id` FOREIGN KEY (`upd_by_id`) REFERENCES `x_portal_user` (`id`)
) ROW_FORMAT=DYNAMIC;

对整个建表脚本中的SQL都需要对应的修改。

相关推荐
2501_941404311 小时前
绿色科技与可持续发展:科技如何推动环境保护与资源管理
大数据·人工智能
swanwei2 小时前
量子科技对核心产业的颠覆性影响及落地时间表(全文2500字)
大数据·网络·人工智能·程序人生·量子计算
isNotNullX6 小时前
数据中台有什么用?数据仓库和数据中台怎么选?
大数据·数据仓库·人工智能·数据中台
roman_日积跬步-终至千里6 小时前
【AI Engineering】Should I build this AI application?—AI应用决策框架与实践指南
大数据·人工智能
DolphinScheduler社区7 小时前
图解 Apache DolphinScheduler 如何配置飞书告警
java·大数据·开源·飞书·告警·任务调度·海豚调度
稚辉君.MCA_P8_Java7 小时前
通义千问 SpringBoot 性能优化全景设计(面向 Java 开发者)
大数据·hadoop·spring boot·分布式·架构
SeaTunnel7 小时前
Apache SeaTunnel 如何将 CDC 数据流转换为 Append-Only 模式?
大数据·开源·apache·开发者·seatunnel·转换插件
万山y7 小时前
git remote add做了什么
大数据·git·elasticsearch
六边形架构8 小时前
别再盲目地堆砌技术了!大部份大数据项目的失败,都是因为架构设计没做对!
大数据·系统架构
驾数者8 小时前
DDL实战指南:如何定义和管理动态表
大数据·sql·flink