Koozali.org: home of the SME Server

Running Multiple MySQL Instances on SME

Offline TerryF

  • grumpy old man
  • *
  • 1,826
  • +6/-0
Re: Running Multiple MySQL Instances on SME
« Reply #15 on: December 13, 2013, 01:10:23 AM »
My SME did not ship with a  password for MySQL's root and we are not advised anywhere to add one.

Have you read this?  http://wiki.contribs.org/MySQL#MySQL_root_password
--
qui scribit bis legit


Offline LANMonkey

  • ****
  • 350
  • +0/-0
    • Database Collection of Transcripts for the ICTY
Re: Running Multiple MySQL Instances on SME
« Reply #17 on: December 13, 2013, 05:27:49 AM »
Thanks all.  I always reset root outside of SME, but was unsure how that would effect MySQL in root.

Offline mmccarn

  • *
  • 2,628
  • +10/-0
Re: Running Multiple MySQL Instances on SME
« Reply #18 on: December 13, 2013, 01:49:43 PM »
First, /etc/init.rd in my SME 9 beta 3 is a link to /etc/rc.d/init.d.  That was a little disorienting, but the file to change was there.

I didn't see any instructions to add a group "mariadb".  When I tried, it rejected mariadb as being already used as a user name and I had to use a different name and make the appropriate changes in the instructions.

Also, testing access with,

Code: [Select]
mysql -e "SELECT VERSION();" --port=3307 --protocol=TCP -p
didn't work until I did a reboot.  And, it did not need an actual password to work, you just a get a prompt for a password and hit "enter" and that should do it.  Same for the example version check.  My SME did not ship with a  password for MySQL's root and we are not advised anywhere to add one.


Thanks for testing things out!

/etc/init.rd vs etc/rc.d/init.d:
Since they're symlinked, it doesn't really matter which one you create your new file in.

Group 'mariadb':
When you create a user in server-manager, SME also creates a group of the same name.

MySQL root password:
SME doesn't make you enter a password for mysql, but it does use a root password for mysql that was generated randomly on your server during installation and can be found in /var/service/mysqld/set.password .  You don't need to enter the password when running 'mysql' or 'mysqladmin' at the command line because SME uses some sort of magic to enter the password for you.

When connecting to mariadb, this randomly generated password is also supplied-- but mariadb really does have an empty root password by default.  Until I added "-p" to my mariadb mysql command after first installing mariadb I got an authentication error.

You can see your randomly generated mysql root password in this file: /var/service/mysqld/set.password

Reboot:
I somehow managed to shutdown mysql while trying to get mariadb to run before I figured out that I was having permission issues with the the pid file creation in /var/run/mariadb.  I rebooted to fix mysql, but I may have needed to reboot for some other reason.

[edits]
root password section edited slightly.
« Last Edit: December 13, 2013, 01:53:17 PM by mmccarn »

Offline LANMonkey

  • ****
  • 350
  • +0/-0
    • Database Collection of Transcripts for the ICTY
There is a typo in the User Talk
« Reply #19 on: December 17, 2013, 01:33:37 AM »
I ran the commands to install MariaDB from the User Talk again on another machine, my SME  8.

There is a typo,

Quote
chown mariadb:maridb /var/run/mariadb

In order to customize the execution line in /etc/init.d/mariadb, you have to find it first.  I used the search function in my Notepad++ to find "$bindir/mysqld_safe", making sure to use a Normal search so that I pick up the dollar sign.

Applying "mysql -e "SELECT VERSION();" --port=3307 --protocol=TCP -p" returns a password prompt.  I enter nothing and hit return, and I get back:

Code: [Select]
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (111)
And so before that command is where you should do a reboot.  After a reboot, I am able to get the version report.

I'm not sure I see the point of,

mysql --port=3307 --protocol=TCP -p < /var/service/mysqld/set.password

I enter that and get a prompt for a password.  Should I have set the password before entering that?  What does "set.password" do?  I don't have a password for my MySQL root user, maybe that was the problem.

The last command works anyway for me.

Offline mmccarn

  • *
  • 2,628
  • +10/-0
Re: Running Multiple MySQL Instances on SME
« Reply #20 on: December 17, 2013, 02:28:39 PM »
maridb (typo):
Corrected (twice).  Thanks.

/etc/init.d/mariadb:
Yes.  I ended up searching for 'mysqld_safe' to find this line.  If there's a lot of interest in mariadb I would either script the edits or create downloadable versions of the various customized files somewhere or hope that someone builds a smeserver-mariadb contrib.

reboot required:
I always assumed that the database initialization script started the database server.  If it doesn't we'd need to insert a command in the process to start mariadb:
Code: [Select]
/etc/init.d/mariadb startIt seems possible to me that starting the database like this would remove the need for a reboot.

mysql --port=3307 --protocol=TCP -p < /var/service/mysqld/set.password
Unless you have gone to great lengths to UNSET it you DO have a password for root on your mysql database.  You don't need to enter a password when you run mysql because the SME devs put it into ~/.my.cnf for you.

However, since there is a password in ~/.my.cnf, it is going to be used to connect to mariadb, too, unless you specify "-p" every time you run mysql --port=3307 --protocol=TCP.

The point of this command is to prompt you for a password once, then SET the password for 'root' on the mariadb database to the same value used for 'root' in mysql, since this password is supplied automatically by the mysql client.

My thought process here is:
1) I don't want to have to remember a new root password
2) The SME devs make very conservative security choices:
  2a) leaving the mariadb root password blank cannot be secure.
  2b) using the SME mysql security mechanisms for the root password in mariadb should be a good security stance.


Offline LANMonkey

  • ****
  • 350
  • +0/-0
    • Database Collection of Transcripts for the ICTY
MariaDB appears to hanging boots of SME server
« Reply #21 on: December 21, 2013, 07:28:02 PM »
I installed this MariaDB on my SME 9.0 test server before I tried it on SME 8.0.  This problem is on SME 8.0, it is not a problem on my test server, SME 9.0 alpha 2.

When I boot up SME 8.0, as I see things starting up withe [OK] prompts, the start for MySQL hangs with the prompt "starting MariaDB" followed by ticks popping up every second for about 10 lines on the screen, or about 10 to 15 minutes.  Eventually, SME does boot up.

I might add I also have upgraded the main MySQL server according to the suggestions posted above and explained at this link here:

http://forums.contribs.org/index.php/topic,50081.0.html

But it is also installed on my 9.0 server alongside MariaDB with no problems.

What is going on?  Why does it take so long for MariaDB to start up on 8.0?  What can I do to fix this or look into it further?

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: MariaDB appears to hanging boots of SME server
« Reply #22 on: December 21, 2013, 07:59:51 PM »
LANMonkey

Quote
I installed this MariaDB on my SME 9.0 test server before I tried it on SME 8.0.  This problem is on SME 8.0, it is not a problem on my test server, SME 9.0 alpha 2.

You should be testing big changes like this on the same system version, ie on a sme 8 test server, if you are going to install on sme 8 production server.

As for using your stated use of SME 9.0 alpha 2
there are at least 2 more updates, a beta 1 & beta 2 releases, which are much more advanced that alpha 3 was, & there is also a iso for beta 3 available for download & tesing (not officially released yet), see devinfo mail list. You should be testing with the latest release.
See
http://forums.contribs.org/index.php/board,17.0.html


Quote
What can I do to fix this or look into it further?

Look at the log files, especially start up logs
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline LANMonkey

  • ****
  • 350
  • +0/-0
    • Database Collection of Transcripts for the ICTY
Re: MariaDB appears to hanging boots of SME server
« Reply #23 on: December 21, 2013, 08:16:44 PM »
....

Look at the log files, especially start up logs

Which logs are the start up logs?  I checked the boot logs in the logs part of server-manager and it says they are all empty.  I checked the mysqld logs, but the only ones not empty are pretty large.  If that's where to look, what do I look for?  I searched "mariadb" and found nothing.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: MariaDB appears to hanging boots of SME server
« Reply #24 on: December 21, 2013, 08:40:05 PM »
LANMonkey

The standard log to look at for many things is
messages

Also see
dmesg
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline mmccarn

  • *
  • 2,628
  • +10/-0
Re: MariaDB appears to hanging boots of SME server
« Reply #25 on: December 21, 2013, 10:23:52 PM »
Which logs are the start up logs?  I checked the boot logs in the logs part of server-manager and it says they are all empty.  I checked the mysqld logs, but the only ones not empty are pretty large.  If that's where to look, what do I look for?  I searched "mariadb" and found nothing.

The mariadb logs should be in /opt/mariadb-data/<smeservername>.err


Offline LANMonkey

  • ****
  • 350
  • +0/-0
    • Database Collection of Transcripts for the ICTY
Here are the contents of <myserver>.err
« Reply #26 on: December 22, 2013, 10:37:59 PM »
Here are the contents of <myserver>.err

Code: [Select]
131216 15:53:22 mysqld_safe Starting mysqld daemon with databases from /opt/mariadb-data
131216 15:53:24 InnoDB: The InnoDB memory heap is disabled
131216 15:53:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131216 15:53:24 InnoDB: Compressed tables use zlib 1.2.3
131216 15:53:24 InnoDB: Using Linux native AIO
131216 15:53:24 InnoDB: Initializing buffer pool, size = 128.0M
131216 15:53:24 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
131216 15:53:24  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
131216 15:53:25  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
131216 15:53:25  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
131216 15:53:26  InnoDB: Waiting for the background threads to start
131216 15:53:27 Percona XtraDB (http://www.percona.com) 5.5.34-MariaDB-31.1 started; log sequence number 0
131216 15:53:27 [Note] Plugin 'FEEDBACK' is disabled.
131216 15:53:28 [Note] Server socket created on IP: '0.0.0.0'.
131216 15:53:28 [Note] Event Scheduler: Loaded 0 events
131216 15:53:28 [Note] /opt/mariadb/bin/mysqld: ready for connections.
Version: '5.5.34-MariaDB-log'  socket: '/opt/mariadb-data/mariadb.sock'  port: 3307  MariaDB Server
131219 10:37:16 mysqld_safe Starting mysqld daemon with databases from /opt/mariadb-data
131219 10:37:17 InnoDB: The InnoDB memory heap is disabled
131219 10:37:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131219 10:37:17 InnoDB: Compressed tables use zlib 1.2.3
131219 10:37:17 InnoDB: Using Linux native AIO
131219 10:37:17 InnoDB: Initializing buffer pool, size = 128.0M
131219 10:37:17 InnoDB: Completed initialization of buffer pool
131219 10:37:17 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
131219 10:37:17  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
131219 10:37:18  InnoDB: Waiting for the background threads to start
131219 10:37:19 Percona XtraDB (http://www.percona.com) 5.5.34-MariaDB-31.1 started; log sequence number 1597945
131219 10:37:19 [Note] Plugin 'FEEDBACK' is disabled.
131219 10:37:19 [Note] Recovering after a crash using mysql-bin
131219 10:37:19 [Note] Starting crash recovery...
131219 10:37:19 [Note] Crash recovery finished.
131219 10:37:19 [Note] Server socket created on IP: '0.0.0.0'.
131219 10:37:19 [ERROR] mysqld: Table './mysql/user' is marked as crashed and should be repaired
131219 10:37:19 [Warning] Checking table:   './mysql/user'
131219 10:37:19 [ERROR] mysql.user: 1 client is using or hasn't closed the table properly
131219 10:37:19 [Note] Event Scheduler: Loaded 0 events
131219 10:37:19 [Note] /opt/mariadb/bin/mysqld: ready for connections.
Version: '5.5.34-MariaDB-log'  socket: '/opt/mariadb-data/mariadb.sock'  port: 3307  MariaDB Server
131221 09:28:25 mysqld_safe Starting mysqld daemon with databases from /opt/mariadb-data
131221  9:28:27 InnoDB: The InnoDB memory heap is disabled
131221  9:28:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131221  9:28:27 InnoDB: Compressed tables use zlib 1.2.3
131221  9:28:27 InnoDB: Using Linux native AIO
131221  9:28:27 InnoDB: Initializing buffer pool, size = 128.0M
131221  9:28:27 InnoDB: Completed initialization of buffer pool
131221  9:28:27 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
131221  9:28:27  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
131221  9:28:27  InnoDB: Waiting for the background threads to start
131221  9:28:28 Percona XtraDB (http://www.percona.com) 5.5.34-MariaDB-31.1 started; log sequence number 1597945
131221  9:28:29 [Note] Plugin 'FEEDBACK' is disabled.
131221  9:28:29 [Note] Recovering after a crash using mysql-bin
131221  9:28:29 [Note] Starting crash recovery...
131221  9:28:29 [Note] Crash recovery finished.
131221  9:28:29 [Note] Server socket created on IP: '0.0.0.0'.
131221  9:28:29 [Note] Event Scheduler: Loaded 0 events
131221  9:28:29 [Note] /opt/mariadb/bin/mysqld: ready for connections.
Version: '5.5.34-MariaDB-log'  socket: '/opt/mariadb-data/mariadb.sock'  port: 3307  MariaDB Server

The first thing I looked for was lines with huge differences in time to account for the extremely long time for MySQL to start up in the boot sequence.  I don't see anything.  I suppose it might have helped if I had marked the time the MySQL start line appeared.  I don't want to take my server off line long enough to see what that's like.

I also have MariaDB installed in SME 9 beta 2 (I think) and here is the last day of that log from that server.  I don't see any difference and this server boots up with no delays and no notifications that MariaDB is starting up in the boot sequence.

Code: [Select]
131221 09:45:06 mysqld_safe Starting mysqld daemon with databases from /opt/mariadb-data
131221  9:45:07 InnoDB: The InnoDB memory heap is disabled
131221  9:45:07 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131221  9:45:07 InnoDB: Compressed tables use zlib 1.2.3
131221  9:45:07 InnoDB: Using Linux native AIO
131221  9:45:07 InnoDB: Initializing buffer pool, size = 128.0M
131221  9:45:07 InnoDB: Completed initialization of buffer pool
131221  9:45:07 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
131221  9:45:08  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Last MySQL binlog file position 0 48164780, file name ./mysql-bin.000004
131221  9:45:10  InnoDB: Waiting for the background threads to start
131221  9:45:11 Percona XtraDB (http://www.percona.com) 5.5.34-MariaDB-31.1 started; log sequence number 19776695
131221  9:45:12 [Note] Plugin 'FEEDBACK' is disabled.
131221  9:45:13 [Note] Recovering after a crash using mysql-bin
131221  9:45:13 [Note] Starting crash recovery...
131221  9:45:13 [Note] Crash recovery finished.
131221  9:45:13 [Note] Server socket created on IP: '0.0.0.0'.
131221  9:45:16 [Note] Event Scheduler: Loaded 0 events
131221  9:45:16 [Note] /opt/mariadb/bin/mysqld: ready for connections.
Version: '5.5.34-MariaDB-log'  socket: '/opt/mariadb-data/mariadb.sock'  port: 3307  MariaDB Server

Offline idp_qbn

  • ****
  • 346
  • +0/-0
Re: Running Multiple MySQL Instances on SME
« Reply #27 on: December 23, 2013, 03:58:45 AM »
LANMonkey

STOP - every post you do, you change the title of the thread.  Leave them as they are so others can follow what is happening. Stop it now  or the Bad Fairy may take down your particulars......

Good luck with what you are trying to do, though. Sounds useful :-).

Cheers and Merry Christmas
Ian
___________________
Sydney, NSW, Australia

Offline LANMonkey

  • ****
  • 350
  • +0/-0
    • Database Collection of Transcripts for the ICTY
Re: Running Multiple MySQL Instances on SME
« Reply #28 on: December 23, 2013, 05:00:42 AM »
LANMonkey

STOP - every post you do, you change the title of the thread.  Leave them as they are so others can follow what is happening. Stop it now  or the Bad Fairy may take down your particulars......

Good luck with what you are trying to do, though. Sounds useful :-).

Cheers and Merry Christmas
Ian

OK,  I thought actually titling a post in the subject was good for brownie points from the Good Fairy.

Why do they leave it blank?

Offline idp_qbn

  • ****
  • 346
  • +0/-0
Re: Running Multiple MySQL Instances on SME
« Reply #29 on: December 23, 2013, 05:56:34 AM »
Hmm - when I hit "Reply" the window that opens already has the subject filled in.
Why is yours different? Are you using the "Reply" button or something else?

Cheers
Ian
"Reply" is just under the last posting, on the right bottom corner of the screen.
___________________
Sydney, NSW, Australia