Changes between Version 5 and Version 6 of ChefNotes


Ignore:
Timestamp:
May 15, 2014 3:27:16 PM (10 years ago)
Author:
Geoff Lawler
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ChefNotes

    v5 v6  
    3232             * Options passed to mysql: "--pid-file=/var/db/mysql/mysqld.pid --skip-grant-tables --skip-networking --user=mysql --log=/usr/testbed/log/mysql/base --log-bin=/usr/testbed/log/mysql/update --log-slow-queries=/usr/testbed/log/mysql/slowqueries --max_connections=500"
    3333             * That --skip-networking is troubling. Yeah, we need to change that: {{{Do not listen for TCP/IP connections at all. All interaction with mysqld must be made using named pipes or shared memory (on Windows) or Unix socket files (on Unix). This option is highly recommended for systems where only local clients are permitted.}}}
    34              * I'll restart mysql on myboss without that argument, then I'll investigate secure remote access.
     34             * I'll restart mysql on myboss without that argument, then I'll investigate secure remote access.
     35             * edited {{{/usr/local/etc/rc.d/2.mysql-server.sh}}}
     36             * killed mysql (mysqld_watchdog should restart it.)
     37                * sudo kill  97362 97535 ; tail -F mysqld_watchdog.log
     38                * seems to have worked.
     39                * I can now connect remotely using mysql client: {{{mysql -h myboss -P 3306}}}. So yay! We'll need to secure the connection somehow though inthe future. Back to script testing.
     40       * running test ruby script. Runs to error (yay!) after making sure the paths are correct.
     41     d. Connect to database and print account information as test of mysql code. After that put it in a recipe and try it on the test nodes.
     42       * OK! I can query for account information from a test node. The test script is:
     43{{{
     44#!ruby
     45#!/usr/bin/env ruby                                                                             
     46                                                                                               
     47require 'rubygems'                                                                             
     48require 'mysql2'                                                                               
     49                                                                                               
     50client = Mysql2::Client.new(:host => "myboss", :username => "mysql", :database => "tbdb")       
     51                                                                                               
     52stmt = "select distinct "                                                                       
     53stmt << "  u.uid,u.usr_pswd,u.unix_uid,u.usr_name, "                                           
     54stmt << "  p.trust,g.pid,g.gid,g.unix_gid,u.admin, "                                           
     55stmt << "  u.emulab_pubkey,u.home_pubkey, "                                                     
     56stmt << "  UNIX_TIMESTAMP(u.usr_modified), "                                                   
     57stmt << "  u.usr_email,u.usr_shell, "                                                           
     58stmt << "  u.widearearoot,u.wideareajailroot, "                                                 
     59stmt << "  u.usr_w_pswd,u.uid_idx "                                                             
     60stmt << "from group_membership as p "                                                           
     61stmt << "join users as u on p.uid_idx=u.uid_idx "                                               
     62stmt << "join groups as g on "                                                                 
     63stmt << "     p.pid=g.pid and p.gid=g.gid "                                                     
     64stmt << "where ((p.pid='Deter')) and p.trust!='none' "                                         
     65stmt << "      and u.status='active' "                                                         
     66stmt << "      and u.webonly=0 "                                                               
     67stmt << "      and g.unix_gid is not NULL "                                                     
     68stmt << "order by u.uid limit 2"                                                               
     69                                                                                               
     70results = client.query(stmt)                                                                   
     71results.each do |row|                                                                           
     72    printf "%s\n", row                                                                                   
     73end                                                                                             
     74}}}
     75
     76This outputs:
     77{{{
     78#!sh
     79./mysql_test.rb
     80{"uid"=>"adititat", "usr_pswd"=>"$1$13954353$MRXeRMUxPc2t4hxFe7o3k0", "unix_uid"=>14427, "usr_name"=>"Aditi Tatti", "trust"=>"local_root", "pid"=>"Deter", "gid"=>"Deter", "unix_gid"=>6004, "admin"=>0, "emulab_pubkey"=>nil, "home_pubkey"=>nil, "UNIX_TIMESTAMP(u.usr_modified)"=>1398879458, "usr_email"=>"tatti@usc.edu", "usr_shell"=>"bash", "widearearoot"=>0, "wideareajailroot"=>0, "usr_w_pswd"=>"03b%5m*g", "uid_idx"=>14536}
     81{"uid"=>"alba", "usr_pswd"=>"$1$12831943$YeNdFr60Aj79NiddzObMQ/", "unix_uid"=>11615, "usr_name"=>"Alba Palacios", "trust"=>"local_root", "pid"=>"Deter", "gid"=>"Deter", "unix_gid"=>6004, "admin"=>1, "emulab_pubkey"=>nil, "home_pubkey"=>nil, "UNIX_TIMESTAMP(u.usr_modified)"=>1398879433, "usr_email"=>"alba@isi.edu", "usr_shell"=>"tcsh", "widearearoot"=>0, "wideareajailroot"=>0, "usr_w_pswd"=>"%!<0fsKo", "uid_idx"=>11681}
     82}}}
     83
     84    e. So now all I need to do is learn Ruby.
    3585
    3686=== Scratch ===