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

相关推荐
人大博士的交易之路11 分钟前
龙虎榜——20250422
大数据·数学建模·数据挖掘·缠论·缠中说禅·涨停回马枪·龙虎榜
TDengine (老段)44 分钟前
TDengine 流计算引擎设计
大数据·数据库·物联网·flink·时序数据库·tdengine·涛思数据
全栈开发圈1 小时前
新书速览|Hadoop与Spark大数据全景解析(视频教学版)
大数据·hadoop·spark
ShAn DiAn1 小时前
实时步数统计系统 kafka + spark +redis
大数据·redis·分布式·spark·kafka
用户199701080182 小时前
深入研究:Shopee商品列表API接口详解
大数据·爬虫·数据挖掘
胡耀超2 小时前
5.第五章:数据分类的方法论
大数据·人工智能·分类·数据挖掘·数据治理·数据分类·分类分级
神奇的黄豆2 小时前
Spark-streaming核心编程
大数据·spark
苏小夕夕2 小时前
kafka安装、spark安装
大数据·spark·kafka
火龙谷3 小时前
【hadoop】HBase shell 操作
大数据·hadoop·hbase
随缘而动,随遇而安3 小时前
第五十二篇 浅谈ETL系统设计
大数据·数据仓库·数据分析·数据库开发·数据库架构