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

相关推荐
欧亚学术27 分钟前
计算机网络领域所有CCF-A/B/C类期刊汇总!
大数据·计算机网络·计算机·论文·sci·期刊·发表
江瀚视野38 分钟前
虎扑正式易主,迅雷完成收购会带来什么变化?
大数据·区块链
QYR_112 小时前
宠物车载安全座椅市场报告:解读行业趋势与投资前景
大数据·人工智能
Leo.yuan2 小时前
实时数据仓库是什么?数据仓库设计怎么做?
大数据·数据库·数据仓库·数据分析·spark
@BreCaspian2 小时前
Git 推送失败解决教程——error: failed to push some refs to
大数据·git·elasticsearch
郭泽元5 小时前
递归树形菜单:优雅处理层级数据的利器
大数据
viperrrrrrrrrr75 小时前
大数据学习(130)-zookeeper
大数据·学习·zookeeper
火龙谷6 小时前
【hadoop】Davinci数据可视化工具的安装部署
大数据·hadoop·分布式
国际云7 小时前
腾讯云国际版和国内版账户通用吗?一样吗?为什么?
大数据·运维·阿里云·云计算
£菜鸟也有梦7 小时前
从0到1,带你走进Flink的世界
大数据·hadoop·flink·spark