Created on 03-19-2020 02:07 PM - last edited on 03-19-2020 03:09 PM by lwang
I have recently installed Ranger in my cluster and I am not able to start All database connection is OK. Below is the error. It's something about the time zone. I am using MySql, I am also attaching screen shot of main configuration.
stderr:
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/stacks/HDP/3.0/services/RANGER/package/scripts/ranger_admin.py", line 236, in
RangerAdmin().execute()
File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 353, in execute
method(env)
File "/var/lib/ambari-agent/cache/stacks/HDP/3.0/services/RANGER/package/scripts/ranger_admin.py", line 97, in start
self.configure(env, upgrade_type=upgrade_type, setup_db=params.stack_supports_ranger_setup_db_on_start)
File "/var/lib/ambari-agent/cache/stacks/HDP/3.0/services/RANGER/package/scripts/ranger_admin.py", line 132, in configure
setup_ranger_xml.setup_ranger_db()
File "/var/lib/ambari-agent/cache/stacks/HDP/3.0/services/RANGER/package/scripts/setup_ranger_xml.py", line 267, in setup_ranger_db
user=params.unix_user,
File "/usr/lib/ambari-agent/lib/resource_management/core/base.py", line 166, in __init__
self.env.run()
File "/usr/lib/ambari-agent/lib/resource_management/core/environment.py", line 160, in run
self.run_action(resource, action)
File "/usr/lib/ambari-agent/lib/resource_management/core/environment.py", line 124, in run_action
provider_action()
File "/usr/lib/ambari-agent/lib/resource_management/core/providers/system.py", line 263, in action_run
returns=self.resource.returns)
File "/usr/lib/ambari-agent/lib/resource_management/core/shell.py", line 72, in inner
result = function(command, **kwargs)
File "/usr/lib/ambari-agent/lib/resource_management/core/shell.py", line 102, in checked_call
tries=tries, try_sleep=try_sleep, timeout_kill_strategy=timeout_kill_strategy, returns=returns)
File "/usr/lib/ambari-agent/lib/resource_management/core/shell.py", line 150, in _call_wrapper
result = _call(command, **kwargs_copy)
File "/usr/lib/ambari-agent/lib/resource_management/core/shell.py", line 314, in _call
raise ExecutionFailed(err_msg, code, out, err)
resource_management.core.exceptions.ExecutionFailed: Execution of 'ambari-python-wrap /usr/hdp/current/ranger-admin/dba_script.py -q' returned 1. 2020-03-19 16:56:38,687 [I] Running DBA setup script. QuiteMode:True
2020-03-19 16:56:38,687 [I] Using Java:/usr/jdk64/jdk1.8.0_112/bin/java
2020-03-19 16:56:38,687 [I] DB FLAVOR:MYSQL
2020-03-19 16:56:38,687 [I] DB Host:namenode.asotc.com
2020-03-19 16:56:38,688 [I] ---------- Verifying DB root password ----------
2020-03-19 16:56:38,688 [I] DBA root user password validated
2020-03-19 16:56:38,688 [I] ---------- Verifying Ranger Admin db user password ----------
2020-03-19 16:56:38,688 [I] admin user password validated
2020-03-19 16:56:38,689 [I] ---------- Creating Ranger Admin db user ----------
2020-03-19 16:56:38,689 [JISQL] /usr/jdk64/jdk1.8.0_112/bin/java -cp /usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar:/usr/hdp/current/ranger-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://namenode.asotc.com/mysql -u root -p '********' -noheader -trim -c \; -query "SELECT version();"
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: 01S00 java.sql.SQLException: The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support. ErrorCode: 0
2020-03-19 16:56:39,340 [E] Can't establish db connection.. Exiting..
Created 03-19-2020 03:08 PM
Hi @prakashpunj,
My research found this from other co-worker's notes:
The error message seems related with mysql timezone and you can try to setup it using this doc:
https://stackoverflow.com/questions/930900/how-do-i-set-the-time-zone-of-mysql
Could you please give it a try and let us know if that helps?
Thanks,
Li
Li Wang, Technical Solution Manager
Created 03-19-2020 04:23 PM
select now command produce right result. Also I am putting below in the connection string which should address the issue
?serverTimezone=UTC
MariaDB [(none)]> select now();
+---------------------+
| now() |
+---------------------+
| 2020-03-19 19:21:24 |
+---------------------+
1 row in set (0.00 sec)
Created 03-19-2020 04:50 PM
Hi @prakashpunj ,
Can you please try to set in my.cnf with
default-time-zone='-08:00'
and see if that helps?
Thanks!
Li
Li Wang, Technical Solution Manager
Created 03-19-2020 05:21 PM
No help still not able to start ranger:
2020-03-19 20:20:10,288 [JISQL] /usr/jdk64/jdk1.8.0_112/bin/java -cp /usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar:/usr/hdp/current/ranger-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://namenode.asotc.com/mysql -u root -p '********' -noheader -trim -c \; -query "SELECT version();"
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: 01S00 java.sql.SQLException: The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support. ErrorCode: 0
2020-03-19 20:20:11,050 [E] Can't establish db connection.. Exiting..
Created 03-19-2020 08:04 PM
Hi @prakashpunj ,
Sorry there maybe a miscalculation. Please try this:
1. Update /etc/my.cnf file to match the timezone for EDT and UTC
default_time_zone='+04:00'
2. Change the connection string to
jdbc:mysql://xxxx:3306/ranger?serverTimezone=UTC
Please give this a try and let us know if that helps.
Thanks,
Li
Li Wang, Technical Solution Manager
Created 03-20-2020 07:37 AM
Created 03-20-2020 10:20 AM
Hi @prakashpunj ,
sorry to hear that. did you restart MySQL after modfiying the configuration file?
thanks,
Li
Li Wang, Technical Solution Manager
Created 03-20-2020 10:34 AM