Ask Your Question
0

Puppet - mySQL not remotely accessible upon setup (workbench)

asked 2015-05-13 21:27:27 -0500

pup-master gravatar image

updated 2015-05-20 13:17:29 -0500

I used Puppet's mySQL module to bring it up like this.

The workstation ip is 10.213.9.215 and JIRA(mySQL) VM is 10.213.9.157 (Puppet Master is 10.213.9.116);

I'm trying to access mySQL server using workbench mySQL client tool from workstation 10.213.9.215 (hence @10.213.9.215 in the grant).

Usually I know I can remotely access if I can view htp:/10.213.9.157:3306 on the browser. On mySQL VM, if I do htp:/localhost:3306, I see some messages that means I can access the mySQL server. But htp:/10.213.9.157:3306 on itself doesn't work either.

Where the heck in my Puppet for mySQL code, did I mess up? I think somewhere in my puppet code, I am not allowing mySQL server to allow remote access.

[Code - 1]

node 'jira.oracle' { class {'mysql::server':} }

class mysql::server {

package { "mysql-server": ensure => installed }
package { "mysql": ensure => installed }

service { "mysqld":
enable => true,
ensure => running,
require => Package["mysql-server"],
}

file { "/var/lib/mysql/my.cnf":
owner => "mysql", group => "mysql",
source => "puppet:///fs/my.cnf",
notify => Service["mysqld"],
require => Package["mysql-server"],
}

file { "/etc/my.cnf":
require => File["/var/lib/mysql/my.cnf"],
ensure => "/var/lib/mysql/my.cnf",
}

}

[Code - 2]

node 'jira.oracle' {

    class { '::mysql::server':
     root_password           => 'secret',
     remove_default_accounts => true,
     override_options        => $override_options,
     create_root_my_cnf => true,  
     config_file => '/etc/my.cnf',
 manage_config_file => true,
 }



    file { "/var/lib/mysql/my.cnf":
            owner => "mysql", group => "mysql",
            source => "puppet:///fs/my.cnf",
            notify => Service["mysqld"],
            require => Package["mysql-server"],
         }




     ::mysql::db { 'jiraDB':
     user     => 'jira',
     password => 'secret',
     dbname   => 'jiraDB',
     host     => 'localhost',
    }

    mysql_grant { 'jira@localhost/*.*':
      ensure     => 'present',
      options    => ['GRANT'],
      privileges => ['ALL'],
      table      => '*.*',
      user       => 'jira@localhost' ,
    }

    mysql_grant { 'root@localhost/*.*':
      ensure     => 'present',
      options    => ['GRANT'],
      privileges => ['ALL'],
      table      => '*.*',
      user       => 'root@localhost' ,
    }

    mysql_grant { 'jira@10.213.9.215/*.*':
      ensure     => 'present',
      options    => ['GRANT'],
      privileges => ['ALL'],
      table      => '*.*',
      user       => 'jira@10.213.9.215' ,
    }

    mysql_grant { 'root@10.213.9.215/*.*':
      ensure     => 'present',
      options    => ['GRANT'],
      privileges => ['ALL'],
      table      => '*.*',
      user       => 'root@10.213.9.215' ,
    }

}

(UPDATE: when I run these two codes, workbench access works, but how do you combine them?) (UPDATE: Code 2 incorporates some of Code 1's. It runs without error, but workbench access is not working. I'm guessing my.cnf file didn't get set properly? How do I make the module configure my.cnf properly by passing variables properly?)

edit retag flag offensive close merge delete

Comments

Your 2nd code file looks more correct to me, since the 1st one appears to be reimplementing the class found in the puppetlabs-mysql module installed from the Puppet Forge. I would simply work on your 2nd code file to make it do everything you want to configure the node.

GregLarkin gravatar imageGregLarkin ( 2015-05-19 17:56:00 -0500 )edit

Thank you for continuing help! really, wouldn't be getting this far alone. Please check the comment on my.cnf on the other post.

pup-master gravatar imagepup-master ( 2015-05-19 20:33:58 -0500 )edit

2nd code has been improvised, but still no workbench access without 1st code

pup-master gravatar imagepup-master ( 2015-05-20 13:36:33 -0500 )edit

At this point, I think you should step back and start reimplementing your code piece by piece. First, get the MySQL server up and running and configured. Then create a database. Then create your users. Each time you add more functionality, test it from the other machine. Eventually, you will get it.

GregLarkin gravatar imageGregLarkin ( 2015-05-20 13:46:37 -0500 )edit

I did what you recommended but workbench isn't working. On the other post. Thank you very much for continued help.

pup-master gravatar imagepup-master ( 2015-05-20 14:57:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-05-18 17:41:44 -0500

GregLarkin gravatar image

Is the Puppet code you included above applied to your database server using a node definition or some other means of classification?

What happens if you run the following command from your workstation?

mysql -h 172.16.1.49 -u jira --password=secret jiraDB

If that errors out with a permissions problem, then you need to go back and make sure that your Puppet code is correct and that it is applied to your database host.

edit flag offensive delete link more

Comments

Thank you for your time yet again! So I updated the post. Turns out, when I run these two mySQL pp files separately, workbench access works. But I'm trying to figure out how to combine them. Just updated the post.

pup-master gravatar imagepup-master ( 2015-05-18 17:58:25 -0500 )edit

"class mysql::server" is already implemented by a Puppet module that you can download from the Puppet Forge. In your first code file, it appears that you are implementing a class with the same name. I think all you need to do is move the resource for /etc/my.cnf into the 2nd file for this to work.

GregLarkin gravatar imageGregLarkin ( 2015-05-18 18:04:52 -0500 )edit

Did that and updated the post with error. Not sure where I'm declaring them again. I don't get this error when they are ran separately. Which one of the definitions shall I have to remove? I moved paragraphs that start with "file." Thanks!

pup-master gravatar imagepup-master ( 2015-05-18 19:56:04 -0500 )edit

jira ~]$ mysql -h 10.213.9.157 -u jira --password=secret jiraDB ERROR 2003 (HY000): Can't connect to MySQL server on '10.213.9.157' (111)

pup-master gravatar imagepup-master ( 2015-05-20 15:08:09 -0500 )edit

You'll have to solve the connectivity problem manually before writing Puppet code to configure it automatically. There could be all kinds of problems here - MySQL server bind address, firewall issues, etc. Eliminate those, configure MySQL client/server manually, then replicate in Puppet code.

GregLarkin gravatar imageGregLarkin ( 2015-05-20 15:41:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-05-13 21:27:27 -0500

Seen: 841 times

Last updated: May 20 '15