I was able to solve this issue by changing char set to utf8 vs utf8mb4

create database ranger DEFAULT CHARACTER SET utf8 DEFAULT COLLATE
utf8_general_ci;


Sanjay Gupta

Lead   Database Administrator

2000 Powell St, Suite 1500 Emeryville, CA 94608

M: 510-219-3062  E: sanjay.gup...@nielsen.com


On Sat, Dec 14, 2024 at 1:29 PM Sanjay Gupta <sanjay.gup...@nielsen.com>
wrote:

> Hi All,
> Ubuntu 20.04.6 LTS
>
> mysql> select @@version ;
> +-------------------------+
> | @@version               |
> +-------------------------+
> | 8.0.40-0ubuntu0.20.04.1 |
> +-------------------------+
>
> Tried Apache Ranger 2.5.1 and 3.0.0 version
>
> After successful build, I am unable to successfully run setup.sh
>
> First issue was with setup.sh, it would fail here and I have found this
> was due useSSL=false so I added allowPublicKeyRetrieval=true  so this line
> becomes
> db_ssl_param="?allowPublicKeyRetrieval=true&useSSL=false"
> and it is able to proceed
>
> + python3 db_setup.py -checkupgrade
> 2024-12-14 19:31:36,787  [I] DB FLAVOR :MYSQL
> 2024-12-14 19:31:36,788  [I] --------- Verifying Ranger DB connection
> ---------
> 2024-12-14 19:31:36,788  [I] Checking connection..
> 2024-12-14 19:31:36,788  [JISQL]
> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java  -cp
> /usr/share/java/mysql-connector-java.jar:/usr/lib/ranger/ranger-2.5.1-admin/jisql/lib/*
> org.apache.util.sql.Jisql -driver mysqlconj -cstring
> jdbc:mysql://localhost/ranger?useSSL=false -u 'rangeradmin' -p '********'
> -noheader -trim -c \;  -query "select 1;"
> Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver
> class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered
> via the SPI and manual loading of the driver class is generally unnecessary.
> SQLException : SQL state: 08001
> java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not
> allowed ErrorCode: 0
> 2024-12-14 19:31:37,206  [E] Can't establish connection!! Exiting..
> 2024-12-14 19:31:37,207  [I] Please run DB setup first or contact
> Administrator..
>
>
> However now it fails here
>
> ./setup.sh
> last few lines where it is failing
>
> 2024-12-14 21:06:14,406  [I] Importing DB schema to database ranger from
> file: ranger_core_db_mysql.sql
> 2024-12-14 21:06:14,406  [JISQL]
> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java  -cp
> /usr/share/java/mysql-connector-java.jar:/usr/lib/ranger/ranger-3.0.0-admin/jisql/lib/*
> org.apache.util.sql.Jisql -driver mysqlconj -cstring
> jdbc:mysql://localhost/ranger?allowPublicKeyRetrieval=true&useSSL=false -u
> 'rangeradmin' -p '********' -noheader -trim -c \; -input
> /usr/lib/ranger/ranger-3.0.0-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
>
> Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver
> class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered
> via the SPI and manual loading of the driver class is generally unnecessary.
> Error executing: CREATE TABLE `x_trx_log_v2` (   `id` bigint(20) NOT NULL
> AUTO_INCREMENT,   `create_time` datetime DEFAULT NULL,   `added_by_id`
> bigint(20) DEFAULT NULL,   `class_type` int(11) NOT NULL DEFAULT '0',
> `object_id` bigint(20) DEFAULT NULL,   `parent_object_id` bigint(20)
> DEFAULT NULL,   `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
> `parent_object_name` varchar(1024) DEFAULT NULL,   `object_name`
> varchar(1024) DEFAULT NULL,   `change_info` MEDIUMTEXT NULL DEFAULT NULL,
> `trx_id` varchar(1024) DEFAULT NULL,   `action` varchar(255) DEFAULT NULL,
>   `sess_id` varchar(512) DEFAULT NULL,   `req_id` varchar(30) DEFAULT NULL,
>   `sess_type` varchar(30) DEFAULT NULL,   PRIMARY KEY (`id`),   KEY
> `x_trx_log_v2_FK_added_by_id` (`added_by_id`),   KEY `x_trx_log_v2_cr_time`
> (`create_time`),   KEY `x_trx_log_v2_trx_id` (`trx_id`)
> )ROW_FORMAT=DYNAMIC;
> java.sql.SQLSyntaxErrorException: Specified key was too long; max key
> length is 3072 bytes
> SQLException : SQL state: 42000 java.sql.SQLSyntaxErrorException:
> Specified key was too long; max key length is 3072 bytes ErrorCode: 1071
> 2024-12-14 21:06:16,281  [E] ranger_core_db_mysql.sql file import failed!
>
>
> How to resolve this issue ?
>
>

Reply via email to