Skip to content

Commit

Permalink
[HOPSWORKS-1387] Upgrade to NDB 8 (logicalclocks#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
smkniazi authored Oct 22, 2020
1 parent defca87 commit 6c69038
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 49 deletions.
8 changes: 4 additions & 4 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
include_attribute "kagent"

version ="7"
default['ndb']['majorVersion'] ="6"
default['ndb']['minorVersion'] ="9"
version ="8"
default['ndb']['majorVersion'] ="0"
default['ndb']['minorVersion'] ="21"

default['ndb']['version'] = "#{version}.#{node['ndb']['majorVersion']}.#{node['ndb']['minorVersion']}"
default['ndb']['enabled'] = "true"
default['ndb']['glib_version'] = "2.12"

default['ndb']['url'] = node['download_url'] + "/mysql-cluster-gpl-#{node['ndb']['version']}-linux-glibc#{node['ndb']['glib_version']}-x86_64.tar.gz"
default['ndb']['url'] = node['download_url'] + "/mysql-cluster-#{node['ndb']['version']}-linux-glibc#{node['ndb']['glib_version']}-x86_64.tar.gz"
# checksum is not a security check - used to improve the speed of downloads by skipping if matched
# checksum calculated using: shasum -a 256 /var/www/hops/...tgz | cut -c-12
# checksum calculated using: sha256sum /var/www/hops/...tgz | cut -c-12
Expand Down
31 changes: 0 additions & 31 deletions providers/mysql_ndb.rb
Original file line number Diff line number Diff line change
@@ -1,31 +0,0 @@
action :install_distributed_privileges do
# load the users using distributed privileges
# http://dev.mysql.com/doc/refman/5.5/en/mysql-cluster-privilege-distribution.html
new_resource.updated_by_last_action(false)
if node['ndb']['enabled'] == "true"

ndb_waiter "wait_mysql_started" do
action :wait_until_cluster_ready
end

ndb_mysql_basic "mysqld_start_hop_install" do
wait_time 10
action :wait_until_started
end

distusers = "#{node['mysql']['version_dir']}/share/ndb_dist_priv.sql"
bash 'create_distributed_privileges' do
user node['ndb']['user']
code <<-EOF
#{node['ndb']['scripts_dir']}/mysql-client.sh < #{distusers}
# Test that it works
#{node['ndb']['scripts_dir']}/mysql-client.sh -e "CALL mysql.mysql_cluster_move_privileges();"
echo "Verifying successful conversion of tables.."
#{node['ndb']['scripts_dir']}/mysql-client.sh -e "SELECT CONCAT('Conversion ', IF(mysql.mysql_cluster_privileges_are_distributed(), 'succeeded', 'failed'), '.') AS Result;" | grep "Conversion succeeded"
EOF
new_resource.updated_by_last_action(true)
not_if "#{node['ndb']['scripts_dir']}/mysql-client.sh -e \"SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME LIKE 'mysql_cluster%'\" | grep mysql_cluster", :user => "#{node['ndb']['user']}"
end

end
end
6 changes: 0 additions & 6 deletions recipes/mysqld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@
mode 0700
end

if node['ndb']['enabled'] == "true"
ndb_mysql_ndb "install" do
action :install_distributed_privileges
end
end

if node['kagent']['enabled'] == "true"
kagent_config service_name do
service "NDB" # #{found_id}
Expand Down
4 changes: 0 additions & 4 deletions resources/mysql_ndb.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
actions :install_distributed_privileges

default_action :install_distributed_privileges


15 changes: 11 additions & 4 deletions templates/default/grants.sql.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Give access from this IP

GRANT ALL PRIVILEGES ON *.* to '<%= node['mysql']['user'] %>'@'localhost' identified by '<%= node['mysql']['password'] %>';
GRANT ALL PRIVILEGES ON *.* to '<%= node['mysql']['user'] %>'@'127.0.0.1' identified by '<%= node['mysql']['password'] %>';
GRANT GRANT OPTION ON *.* to '<%= node['mysql']['user'] %>'@'localhost' identified by '<%= node['mysql']['password'] %>';
GRANT GRANT OPTION ON *.* to '<%= node['mysql']['user'] %>'@'127.0.0.1' identified by '<%= node['mysql']['password'] %>';
CREATE USER if not exists '<%= node['mysql']['user'] %>'@'localhost' identified by '<%= node['mysql']['password'] %>';
CREATE USER if not exists '<%= node['mysql']['user'] %>'@'127.0.0.1' identified by '<%= node['mysql']['password'] %>';

GRANT NDB_STORED_USER ON *.* to '<%= node['mysql']['user'] %>'@'localhost';
GRANT NDB_STORED_USER ON *.* to '<%= node['mysql']['user'] %>'@'127.0.0.1';

GRANT ALL PRIVILEGES ON *.* to '<%= node['mysql']['user'] %>'@'localhost';
GRANT ALL PRIVILEGES ON *.* to '<%= node['mysql']['user'] %>'@'127.0.0.1';

GRANT GRANT OPTION ON *.* to '<%= node['mysql']['user'] %>'@'localhost';
GRANT GRANT OPTION ON *.* to '<%= node['mysql']['user'] %>'@'127.0.0.1';

0 comments on commit 6c69038

Please sign in to comment.