Skip to content

Commit

Permalink
[HOPSWORKS-2626] MySQL timezone issue (logicalclocks#73)
Browse files Browse the repository at this point in the history
MySQL fails to start with Timezone `EDT` is unrecognized or represents
more than one timezone. The fix is to set the timezone explicitly.
  • Loading branch information
SirOibaf authored Jul 1, 2021
1 parent 4ea2a06 commit 693f9cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion recipes/mysqld.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'time'

ndb_connectstring()

case node['platform_family']
Expand Down Expand Up @@ -69,7 +71,8 @@
:mysql_id => found_id,
# Here is always false, as this recipe is run before certificates are available
# if mysql/tls is enabled, the file will be re-templated later
:mysql_tls => false
:mysql_tls => false,
:timezone => Time.now.strftime("%:z")
})
if node['services']['enabled'] == "true"
notifies :enable, resources(:service => service_name), :immediately
Expand Down
5 changes: 4 additions & 1 deletion recipes/mysqld_tls.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'time'

# This recipe is here to reconfigure the MySQL server to use TLS (if TLS is enabled)
# It cannot be done in the mysqld.rb recipe as we need MySQL to start Hopsworks to start the CA
# That's why this recipe is run after kagent::default (responsible for signing the certificates)
Expand Down Expand Up @@ -40,7 +42,8 @@
:mysql_tls => true,
:certificate => certificate,
:key => key,
:hops_ca => hops_ca
:hops_ca => hops_ca,
:timezone => Time.now.strftime("%:z")
})
notifies :restart, resources(:service => "mysqld"), :immediately
end
Expand Down
2 changes: 2 additions & 0 deletions templates/default/my-ndb.cnf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ max-connections = 512
max-prepared-stmt-count = 65530
local_infile = OFF

default-time-zone = "<%= @timezone %>"

# Explicit defaults for TS needed by 'airflow initdb'
explicit_defaults_for_timestamp = 1

Expand Down

0 comments on commit 693f9cd

Please sign in to comment.