install mariadb on ibm i - tips, troubleshooting, and more

80
© 2016 Rogue Wave Software, Inc. All Rights Reserved. 1 Install MariaDB on IBM i - Tips, troubleshooting, and more Rod Flohr, IBM i Support Specialist ZendCon 2016 link https://legacy.joind.in/ 19527

Upload: rod-flohr

Post on 15-Jan-2017

128 views

Category:

Internet


2 download

TRANSCRIPT

Page 1: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

1

Install MariaDB on IBM i - Tips, troubleshooting, and moreRod Flohr, IBM i Support Specialist

ZendCon 2016 linkhttps://legacy.joind.in/19527

Page 2: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

2

Who am I, and Why Should You Trust Me?

• My name is Rod Flohr, and I have been providing support for Zend products on IBM i for the last decade.

• I have helped many customers troubleshoot their MySQL installation. My hypertextual guide posted in my blog at rodflohr.com, is based on those experiences.

• The ZendDBi installer for MariaDB is so new it has not even been released yet. While we have no support experience with it, we anticipate that it will be similar enough to MySQL that many of the same procedures will apply.

• We will continue to improve this presentation as we gain support experience with MariaDB.

Page 3: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

3

Install the Licensed Program

Page 4: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

4

New for MariaDB – ZendDBi is now an LP

• The old ZendDBi installer for MySQL simply created the directories and content, and did some setup, but there was no uninstall.

• The new ZendDBi installer installs a Licensed Program 1ZENDDB. This makes management much easier, provides for a clean uninstall, and should make it possible to update via PTF.

• Another difference is that ZendDBi has been decoupled from the Zend Server distribution. The installer no longer starts up if ZendDBi is not installed when the management menu is invoked.

• The 1ZENDDB Licensed Program will be available as a separate download at zend.com.

Page 5: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

5

Download ZendDBi for IBM i

• This slide will be a lot more impressive in future presentations.• I will grab a screen shot of the download page and put it in here

just as soon as it actually exists.• For now, lets just move on…• Click the download link and let the file download.• Unzip the downloaded zip file to a folder on your desktop.• The unzipped folder will contain a save file, and a user manual in

both text and PDF formats.• Installation instructions can be found in the user manual.

Page 6: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

6

Contents of the unzipped install folder

Page 7: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

7

Verify PTFs for 7.1 Only

You may verify that the required PTFs are installed using these commands in a 5250 terminal session:On V7R1:* DSPPTF LICPGM(5770999) SELECT(MF99011) * DSPPTF LICPGM(5770999) SELECT(MF59547)* DSPPTF LICPGM(5770999) SELECT(MF51795)In the menu that is displayed go to “General Information”:PTF status should either be “temporarily/permanently applied or superseded”.

Page 8: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

8

Create the save file first!

Create the installation SAVF file1. Log on to the IBM i system 5250 terminal with a user profile of *SECOFR user class with all the special authorities (such as QSECOFR).2. CRTSAVF FILE(QGPL/ZDBISAVF10) TEXT('ZendDBi 10 product save file')3. You should see one of these two messages (both are OK): * File ZDBISAVF10 created in library QGPL. * File ZDBISAVF10 in library QGPL already exists.

Page 9: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

9

CRTSAVF command

Page 10: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

10

CRTSAVF Success message

Page 11: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

11

FTP the SAVF – verify FTP is up

Upload the installation package to your system (FTP)Transfer the package using FTP in binary mode to the SAVF ZDBISAVF10 in QGPL:1. Verify that FTP is running on your IBM i system by running the following command and look for 'FTP' or '21' in the Local Port column: NETSTAT *CNN

Page 12: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

12

Use netstat *cnn to verify FTP

Page 13: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

13

Netstat unsorted display

Page 14: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

14

Use F13 to sort the display

Page 15: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

15

Netstat sorted by local port

Page 16: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

16

Netstat after F14 to show port numbers

Page 17: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

17

FTP the SAVF – set current directory

2. Open a command prompt and change the directory to the directory that contains the files you extracted from the ZIP file.

Page 18: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

18

Copy the current directory

Page 19: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

19

Type cd, a space, then paste

Page 20: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

20

FTP the SAVF – FTP session

4. ftp IBM_i_system_name/TCP address5. If requested, enter a valid user profile and password (with write permissions to QGPL).6. Switch to “binary” mode transfer (command may vary by client: bin/binary/type i).7. Transfer the save file to the IBM i system by running the following command: PUT zdbisavf10.savf QGPL/ZDBISAVF10

Page 21: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

21

FTP the SAVF – FTP session

Page 22: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

22

DSPSAVF to make sure it is a valid SAVF

Page 23: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

23

RSTLICPGM to install Zend DBi

Run the installerReturn to your 5250 session and run the installer. You can either run the silent installer or install interactively (recommended).Interactive installation:1. Run the command following command to launch the installer: RSTLICPGM LICPGM(1ZENDDB) DEV(*SAVF) SAVF(QGPL/ZDBISAVF10)2. Wait for the installer to extract temporary files (You’ll see an “X - System” message):

Page 24: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

24

Optional CHGJOB step

Page 25: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

25

RSTLICPGM to install Zend DBi

Page 26: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

26

RSTLICPGM – Welcome!

Page 27: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

27

RSTLICPGM – EULA – Please read

Page 28: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

28

MySQL was detected on port 3306

Page 29: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

29

RSTLICPGM – Progress 20%

Page 30: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

30

RSTLICPGM – Progress 80%

Page 31: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

31

RSTLICPGM – Success!

Page 32: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

32

RSTLICPGM – Thank you!

Should be:GO ZMARIADB/ZDBMENU

Page 33: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

33

Verify Success – go licpgm – option 10

There it is!

Page 34: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

34

Post install tasks

Page 35: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

35

1a. Restrict public permissions for my.cnf

• If my.cnf has *RWX access granted to the public user, the configuration directives in my.cnf will be ignored, and MariaDB will not be configurable.

• This error will appear if MariaDB is started from the PASE command line:Warning: World-writable config file '/usr/local/mariadb/bin/my.cnf' is ignored

• Fix this by running the following commands to exclude *PUBLIC and give user MYSQL *RX premissions. The commands are on the next slide.

• First CALL QCMD to get a multiline command prompt. Then you can copy and paste the commands.

Page 36: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

36

1b. Restrict public permissions for my.cnfUse these CL commands to fix the my.cnf permissions:

CHGAUT OBJ('/usr/local/mariadb/bin/my.cnf') USER(*PUBLIC) DTAAUT(*EXCLUDE) OBJAUT(*NONE) CHGAUT OBJ('/usr/local/mariadb/bin/my.cnf') USER(MYSQL) DTAAUT(*RX) OBJAUT(*NONE) CHGAUT OBJ('/usr/local/mariadb-10.1.12-os400-powerpc/bin/my.cnf') USER(*PUBLIC) DTAAUT(*EXCLUDE) OBJAUT(*NONE) CHGAUT OBJ('/usr/local/mariadb-10.1.12-os400-powerpc/bin/my.cnf') USER(MYSQL) DTAAUT(*RX) OBJAUT(*NONE)

Page 37: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

37

2a. Start the MariaDB server and verify it is running

• From a command line, as a *SECOFR class user:GO ZMARIADB/ZDBMENU

• Please use option “1. Start Subsystem”.• Then use option “3. Work with Subsystem”.• Start up might take a couple of minutes, so you might have to hit

F5 every minute or so, until the subsystem appears to have only these two jobs:ZENDDBID MYSQL BCI .0 PGM-sh THDWZENDDBID MYSQL BCI .0 PGM-mysqld SELW

Page 38: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

38

2b. Start the MariaDB server and verify it is running

Page 39: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

39

If the jobs are not running…

• If the expected jobs are not running, it is time to do some troubleshooting. Skip down to the troubleshooting section.

• Come back here and continue with the Post Install Tasks after the jobs are working.

Page 40: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

40

3a. Set the MariaDB root user password• This step needs to be done in a PASE shell. I had trouble running the mysql

command in the PASE shell accessible from the CL command line using the QP2TERM command. So I used an ssh terminal to do this demo.

• I later learned we can use the mysql command in QP2TERM by entering this line first:export TERM=xterm

• I like to use a free program called ExtraPuTTY to run my ssh terminal. It is simple to use, and works very well. It is also priced right. http://www.extraputty.com/download.php

• As with any free software download, be cautious about additional software that may be “included”, and be sure to scan for viruses.

• Use netstat *cnn to see if SSH is running. It uses port 22. If it is not started: STRTCPSVR *SSHD

• To connect with ExtraPuTTY, enter your IBM i IP address, port 22, and Connection type SSH. You shouldn’t need to mess with anything else.

• When you connect, you will be prompted for a user (login as) and password. You will then see a dollar sign prompt. You are ready to start entering commands

Page 41: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

41

3b. Set the MariaDB root user password• In the ssh terminal session, enter this command to set your directory:

cd /usr/local/mariadb/bin• You can copy the command and then paste into PuTTY by just

copying it and then positioning the mouse cursor in PuTTY and right clicking. You can also copy out of PuTTY by just highlighting the text to copy (position cursor, hold down left mouse button, drag over text to copy, release mouse button to copy highlighted text to clipboard).

• Enter this command to set the root password to bobbysox:mysqladmin -u root password 'bobbysox‘

• Now you have to add the –p argument to specify a password to use the mysqladmin command. This is because user root is now password protected. Lets change the password to belladonna:mysqladmin -u root -pbobbysox password 'belladonna‘

• There is no space between the “-p” option and the value “bobbysox”

Page 42: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

42

3c. Set the MariaDB root user password

Page 43: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

43

3d. Set the MariaDB root user password

• The root password should now be “belladonna”. Lets see if we can use it to get into a MariaDB session, using the mysql command:mysql -u root –pbelladonna

• You should see something like this:

$ mysql -u root -pbelladonna

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 11

Server version: 10.1.12-MariaDB-debug Source distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

readline: warning: turning on OPOST for terminal

readline: warning: turning on OPOST for terminal

MariaDB [(none)]>

Page 44: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

44

3e. Set the MariaDB root user password

Page 45: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

45

3f. Set the MariaDB root user password

• Now we are inside the MariaDB terminal session. Notice the prompt:MariaDB [(none)]>

• Commands in the MariaDB terminal are SQL commands. They must end with a semicolon, just like DB2 commands entered in the SQL utility in Navigator.

• Lets run this command to see the users and passwords:SELECT User, Host, Password FROM mysql.user;

Page 46: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

46

3g. Set the MariaDB root user password

Page 47: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

47

3h. Set the MariaDB root user password• We see that user root has been assigned to four hosts (IP

addresses) detected by the MariaDB setup. Only one host, localhost, has a password. It is encrypted, but it is “belladonna”. Lets enter these commands to set the password for the other hosts:SET PASSWORD FOR 'root'@'i72sup1.cvo.roguewave.com' = PASSWORD('belladonna'); SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('belladonna');SET PASSWORD FOR 'root'@'::1' = PASSWORD('belladonna');

• After each command, this message appears:Query OK, 0 rows affected (0.00 sec)

• I had some trouble copying these out of Powerpoint into the PASE shell, because Powerpoint changed some of the quotes to tilted quotes. ¯\_(ツ )_/¯

• Lets run our query again:SELECT User, Host, Password FROM mysql.user;

Page 48: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

48

3i. Set the MariaDB root user password

Page 49: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

49

3j. Set the MariaDB root user password• Now all four hosts have the same password for user ‘root’.• All of these host addresses reference the local server.• To connect to MariaDB from PHP, as user root, you need to know the

IP address, the port, the user, and the password.• You will use these values in set up routines for PHP applications that

access MariaDB.• You will also use them in programs like Studio that can browse and

work with your data.• Remember, we used port 3307 for MariaDB, because 3306 was

already being used by the old MySQL server.• To get out of the MariaDB terminal and back to the shell, use the

exit command. No semicolon is required.• To end the ssh session, type exit again.

Page 50: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

50

3k. QP2TERM to show export TERM=xterm

Page 51: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

51

4. Install the IBMDB2i storage engine for MariaDB• For MySQL we needed to run a simple command to add the

IBMDB2i storage engine to MySQL.• It is not yet determined if we will need to do the same for

MariaDB. It might be distributed as a PTF update since we now have a Licensed Program for MariaDB.

• The IBMDB2i storage engine allows data to be created and manipulated using MySQL commands in the MySQL server, while storing the physical data in DB2 on the IBM i.

• For the sake of curiosity, the old command was run in a MySQL terminal session:install plugin ibmdb2i soname "ha_ibmdb2i.so";

• Then it could be seen in the list of engines:SHOW ENGINES;

Page 52: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

52

5a. Deploy phpMyAdmin using Zend Deployment • After all the fun we had setting the root passwords from the command

line in the MariaDB terminal, you may be wondering who would want to spoil it by setting up a GUI. If so, phpMyAdmin may not be for you.

• On the other hand, if you are one of those people who likes things to be convenient and comprehensible, we have you covered.

• The “Getting Started” page in Zend Server offers several very powerful, incredibly useful applications you can Deploy, including Magento, Drupal, WordPress, and Joomla. These all use MySQL/MariaDB for data storage.

• If you plan to do anything at all with MariaDB or MySQL, the first of these you will want to Deploy is phpMyAdmin, so you can manage your data.

• So let’s get started!

Page 53: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

53

5b. Deploy phpMyAdmin using Zend Deployment • We have already covered the prerequisites:

Install MariaDB and make sure it is running correctlySet a password for the root user

• Something else I like to do is to set the default IP address for applications. This makes the generated URL for Deployed applications look much nicer. Or a little nicer, anyway.

• To do it, go to the Zend Server UI and navigate to:Administration -> Settings -> UI

• Copy your IBM i IP address out of the browser address into the Default Server field.

• Click the Save button. After a moment a confirmation appears.• No need to restart!

Page 54: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

54

5c. Deploy phpMyAdmin using Zend Deployment

Page 55: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

55

5d. Deploy phpMyAdmin using Zend Deployment • Now, go to the Getting Started page in the UI and find the

phpMyAdmin icon under the “Deploy Sample Apps” heading.• Click it, and begin filling in the prompts.

Page 56: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

56

5e. Deploy phpMyAdmin using Zend Deployment

Page 57: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

57

5f. Deploy phpMyAdmin using Zend Deployment

Page 58: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

58

5g. Deploy phpMyAdmin using Zend Deployment

Page 59: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

59

5h. Deploy phpMyAdmin using Zend Deployment

Page 60: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

60

5i. Deploy phpMyAdmin using Zend Deployment

Page 61: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

61

5j. Deploy phpMyAdmin using Zend Deployment

Page 62: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

62

5k. Deploy phpMyAdmin using Zend Deployment

Page 63: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

63

5l. Deploy phpMyAdmin using Zend Deployment

Page 64: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

64

5m. Deploy phpMyAdmin using Zend Deployment

Page 65: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

65

5n. Deploy phpMyAdmin using Zend Deployment

Page 66: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

66

5o. Deploy phpMyAdmin using Zend Deployment

Page 67: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

67

5p. Deploy phpMyAdmin using Zend Deployment

Page 68: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

68

6a. Automatically start MariaDB at start up

• This is another big improvement over the old MySQL distribution.• We used to have you make an autostart entry from scratch.• With the new ZendDBi with MariaDB, there are now a couple of

menu options that let you set this behavior.• Go to the menu: GO ZMARIADB/ZDBMENU• If you want MariaDB to start automatically at IPL, use option 21:

21. Start ZendDBi subsystem at IPL• If you don’t want it to start automatically at IPL, use option 22:

22. Not to Start ZendDBi subsystem at IPL• Option 21 adds Autostart Job Entry ZDBISTRSBS to subsystem

QSYSWRK. Option 22 removes the entry.

Page 69: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

69

6b. Automatically start MariaDB at start up

Page 70: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

70

And now, we really are done. Unless…

• If you are this far without any problems, you really have done it! You have installed MariaDB, and you are ready to begin using it.

• Now we can talk about some of the problems we might see.

Page 71: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

71

Troubleshooting

Page 72: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

72

Misunderstanding mysql.sock (mariadb.sock)

• When the ZENDDBID jobs won’t start, the customer will often notice a message worded something like this:“Object not found. Object is /tmp/mysql.sock.”

• The report is usually along the lines of: “This mysql.sock file is missing, and that’s why it won’t start. Why is this file missing? Did the installer fail somehow? Can you send me this file?”

• This is all exactly backwards. mysql.sock is a socket file. It only exists when the mysqld daemon is running. If the file does not exist, all that tells us is that the daemon is not running.

• On the other hand, if the socket does exist, but the daemon is not active, then the daemon probably ended abnormally in some way that prevented it from removing the socket on the way down. The abandoned socket can prevent the next start up.

• By the way, the name of the socket file has changed to mariadb.sock:/usr/local/mariadbdata/mariadb.sock

Page 73: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

73

So if it isn’t mariadb.sock…• ZendDBi is a little weird. Getting the messages and interpreting

them turns out to be a little tricky compared to just looking at the most common problems.

• Normally, I do the basic research first to get pointed in the right direction. But for MySQL start up problems, I do it backwards. There are just a few things to check, and it is so often true that one of them is the cause, it just seems like the most efficient method.

• The common problems we will discuss are MySQL problems we have encountered. MariaDB is too new to have revealed any common problems. But we can look for any of these, and if there is anything new we need to know about MariaDB, we will learn about it in due time, probably at the cost of some sadness.

• So, let’s start…

Page 74: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

74

1. QGPL in system library list

• To check this, it is just:dspsysval qsyslibl

• If QGPL is not there, this is probably not your problem.• This problem might also cause a message like this:

CPF1338 received by procedure ZENDDBID. (C D I R)• If this does turn out to be the problem, our solution in the past has

been to make a new start up CL that gets rid of QGPL from the SYSLIBL for the job, then calls the old startup program, that has been renamed. We can probably do something similar for MariaDB. I just haven’t yet, and probably won’t until someone reports this as a MariaDB issue.

http://rodflohr.com/qgpl-in-system-library-list-prevents-zenddbi-mysql-daemon-from-starting/

Page 75: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

75

2. Port conflict• For the old MySQL, we used to think of this more along the lines of

port 3306 in use. Now the new installer resolves port 3306 conflicts on the fly, so we expect this will not be so much of a port 3306 issue as just whatever port gets assigned. But a conflict is always a possibility, and most of the procedures still apply.

• You can still use the information on this issue at my blog site, but you just need to be mindful that instead of port 3306, you may already to be configured to use some other port, and that should be the port you research for a conflict.

• It is also possible you are configured for port 3306, but there is some process not always on, that uses that port, and could block you from starting up on occasion.

http://rodflohr.com/port-3306-in-use-prevents-zenddbi-mysql-daemon-from-starting/

Page 76: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

76

3. Missing job description

• This is an old problem I haven’t seen for a while. Hopefully it was a distribution error that has since been fixed, but I could never track it down. Everybody installed the same package, but only a few did not have this JOBD. It was kind of baffling.

• Anyway, it was easy to check and easy to fix. Try to display the object description. If it’s missing, create it. It is still worth checking, because it only takes a few seconds, and the JOBD can be accidentally deleted.

• The JOBD name is still the same, only the library name has changed:DSPOBJD OBJ(ZMARIADB/ZMYSQLJBDA) OBJTYPE(*JOBD)

• It appears to be identical to the old JOBD, except all references to ZMYSQL have been replaced by ZMARIADB.

http://rodflohr.com/missing-job-description-zmysqljbda-prevents-zenddbi-mysql-daemon-from-starting/

Page 77: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

77

4. Hey, maybe it is something with mariadb.sock

• Just because the mysql.sock message does not tell you that there is a problem with mysql.sock, doesn’t mean it is telling you that there is not a problem with mysql.sock.

• It is possible the daemon cannot create the socket at start up. This would typically be some permissions issue. Maybe someone revoked the authority to write to that directory from the user MYSQL.

• It is also possible that a mysql.sock file already exists. This could be because another mysqld daemon is running. Or, maybe a prior mysqld daemon crashed and could not properly remove the socket.

• Remember, for MariaDB the file is mariadb.sock:/usr/local/mariadbdata/mariadb.sock

http://rodflohr.com/some-problem-with-mysql-sock-prevents-zenddbi-mysql-daemon-from-starting/

Page 78: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

78

5. Start MariaDB in PASE to review errors

• If MariaDB won’t start, and none of the common problems account for it, you can try starting it in an interactive PASE terminal, where you can more easily see the messages that occur at that level.

• Remember, the name of the daemon program is still mysqld, but it runs out of the mariadb folder structure, rather then the mysql folder structure.

• This is the full command to run with all the options:/usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/bin/my.cnf --basedir=/usr/local/mariadb --datadir=/usr/local/mariadbdata --plugin-dir=/usr/local/mariadb/lib/plugin --user=MYSQL --tmpdir=/tmp --log-error=/usr/local/mariadbdata/I72SUP1.cvo.roguewave.com.err --pid-file=/usr/local/mariadbdata/zmariadb.pid --socket=/usr/local/mariadbdata/mariadb.sock --port=3307

http://rodflohr.com/start-zenddbi-mysql-daemon-in-pase-to-review-start-up-errors/

Page 79: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

79

6. Maximize job logging for the start up job

• One final trick is to maximize the job logging in the IBM i job that controls the start up. This job does not really do much, but it is worth a look. This is especially true if you can launch the mysqld daemon from an interactive PASE terminal, but not from starting up the subsystem.

• The jobq name is the same as for the old MySQL based product, but remember the library name is now ZMARIADB.

http://rodflohr.com/maximize-job-logging-for-the-zenddbi-mysql-daemon-start-up-job/

Page 80: Install MariaDB on IBM i - Tips, troubleshooting, and more

© 2016 Rogue Wave Software, Inc. All Rights Reserved.

80

Thank you!

ZendCon 2016 linkhttps://legacy.joind.in/19527