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都需要对应的修改。

相关推荐
编程彩机1 小时前
互联网大厂Java面试:从分布式架构到大数据场景解析
java·大数据·微服务·spark·kafka·分布式事务·分布式架构
vx-bot5556661 小时前
企业微信接口在多租户SaaS平台中的集成架构与数据隔离实践
大数据·架构·企业微信
bubuly4 小时前
软件开发全流程注意事项:从需求到运维的全方位指南
大数据·运维·数据库
xixixi777775 小时前
基于零信任架构的通信
大数据·人工智能·架构·零信任·通信·个人隐私
Hello.Reader6 小时前
Flink 自适应批执行(Adaptive Batch Execution)让 Batch 作业“边跑边优化”
大数据·flink·batch
LaughingZhu7 小时前
Product Hunt 每日热榜 | 2026-01-31
大数据·人工智能·经验分享·搜索引擎·产品运营
babe小鑫7 小时前
中专学历进入快消大厂终端销售岗位的可行性分析
大数据
samFuB7 小时前
【工具变量】区县5A级旅游景区DID数据集(2000-2025年)
大数据
百夜﹍悠ゼ8 小时前
数据治理DataHub安装部署
大数据·数据治理
wdfk_prog8 小时前
解决 `git cherry-pick` 引入大量新文件的问题
大数据·git·elasticsearch