Difference between revisions of "Software Collections:MariaDB"

From SME Server
Jump to: navigation, search
(Start/Stop MariaDB as a system service)
 
(2 intermediate revisions by the same user not shown)
Line 45: Line 45:
  
 
  <nowiki>
 
  <nowiki>
[mariadbd]
+
  [mariadbd]
datadir=/opt/rh/mariadb55/root/var/lib/mysql
+
  datadir=/opt/rh/mariadb55/root/var/lib/mysql
socket=/var/lib/mysql/mariadb55.sock
+
  socket=/var/lib/mysql/mariadb55.sock
port=3307
+
  port=3307
# Disabling symbolic-links is recommended to prevent assorted security risks
+
  # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
+
  symbolic-links=0
# Settings user and group are ignored when systemd is used.
+
  # Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,  
+
  # If you need to run mysqld under different user or group,  
# customize your systemd unit file for mysqld according to the
+
  # customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
+
  # instructions in http://fedoraproject.org/wiki/Systemd
 
+
 
[mariadbd_safe]
+
  [mariadbd_safe]
log-error=/var/log/mariadb55-mariadbd.log
+
  log-error=/var/log/mariadb55-mariadbd.log
pid-file=/opt/rh/mariadb55/root/var/run/mysqld/mariadbd.pid
+
  pid-file=/opt/rh/mariadb55/root/var/run/mysqld/mariadbd.pid
</nowiki>
+
  </nowiki>
  
 
===Start/Stop MariaDB===
 
===Start/Stop MariaDB===
Line 72: Line 72:
 
Issue the following commands as root:
 
Issue the following commands as root:
 
  ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S99mariadb55-mariadbd
 
  ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S99mariadb55-mariadbd
  chkconfig maridb55-mysqld on
+
  chkconfig mariadb55-mysqld on
  config set maria55-mysqld service
+
  config set mariadb55-mysqld service
 
  config setprop mariadb55-mysqld status enabled
 
  config setprop mariadb55-mysqld status enabled
 
The application will now automatically start at boot time as a system service.
 
The application will now automatically start at boot time as a system service.
Line 79: Line 79:
  
 
====Configure private/public access====
 
====Configure private/public access====
If your SME Server is hosting the application and is being accessed by other hosts either locally (LAN) or remotely (WAN) the ports and access privileges need to be set. For this issue the following commands (where 5432 is the port that MariaDB can be reached on):
+
If your SME Server is hosting the application and is being accessed by other hosts either locally (LAN) or remotely (WAN) the ports and access privileges need to be set. For this issue the following commands (where 3307 is the port that MariaDB can be reached on as set in my.conf above - please check if this port is already in use e.g mysql55 from SCL):
  config setprop maridb55-mysqld TCPPort 3307
+
  config setprop mariadb55-mysqld TCPPort 3307
 
  config setprop mariadb55-mysqld UDPPort 3307
 
  config setprop mariadb55-mysqld UDPPort 3307
 
  config setprop mariadb55-mysqld access private
 
  config setprop mariadb55-mysqld access private

Latest revision as of 12:48, 9 July 2018

Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.

Softwarecollections.png

Mariadb.png

Installing and running MariaDB via Software collections

Software Collections has been introduced by Redhat as a safe way to run selective applications on Redhat based distributions in an isolated environment (separate directory), thus not effecting the base installation of the OS. This provides the possibility to e.g. test an application, install a higher version then the version installed by the base system (e.g. PHP), or temporarily use an application.

Software Collections applications can be started at boot as a system service, manually or in a specific shell.

MariaDB

Installation

To be able to install an application from the Software Collections, one must install software collections first. Please see Software collections on how to install this.


Required repository

After installing Software Collections, the scl repository for Mariadb has to be added to the yum repositories. Please see here on how the enable the scl-mariadb55 repository.


Install application

After installing the scl-mariadb55 repository, MySQL can be installed by issuing the following command:

yum install mariadb55 --enablrepo=scl-mariadb55

Once installed, the application is installed on your SME Server at /opt/rh/mariadb55- as an isolated environment for the application.

Only 1 service script has been installed on your base SME Server which is /etc/rc.d/init.d/mariadb55-mariadb. This script will start and stop the installed application.


Test installed application

Once Mariadb has been installed, you can check if it is correctly installed by issuing:

scl -l

which will provide you a listing of all applications that are available on your system installed via Software Collections.

A simple man page about the installed application is now available via:

scl enable mariadb55 'man mariadb55'

press 'q' to leave the man page

Changes to my.cnf configuration file

Now that the scl version of Mariadb is installed, the /opt/rh/mariadb55/root/etc/my.cnf configuration file has to be adjusted so that the scl version of MariaDB does not interfere with the standard version of MySQL. The default port of MariaDB is 3306, for the scl version of MySQL we will use port 3307, but this can be any port of your choosing. The default socket file is /var/lib/mysql/mysql.sock, for the scl version of MariaDB we will use /var/lib/mariadb/mariadb55.sock.

/opt/rh/mariadb55/root/etc/my.cnf will then be:

   [mariadbd]
   datadir=/opt/rh/mariadb55/root/var/lib/mysql
   socket=/var/lib/mysql/mariadb55.sock
   port=3307
   # Disabling symbolic-links is recommended to prevent assorted security risks
   symbolic-links=0
   # Settings user and group are ignored when systemd is used.
   # If you need to run mysqld under different user or group, 
   # customize your systemd unit file for mysqld according to the
   # instructions in http://fedoraproject.org/wiki/Systemd
   
   [mariadbd_safe]
   log-error=/var/log/mariadb55-mariadbd.log
   pid-file=/opt/rh/mariadb55/root/var/run/mysqld/mariadbd.pid
   

Start/Stop MariaDB

Important.png Note:
How to connect to maridb55, for using 'mysql' will invoke the CLI of the standard MySQL version and not the scl version. Not even when trying to start /opt/rh/maridb55/bin/mysql, it will invoke the 'old' MySQL.

MariaDB is now installed and can be started and stopped manually via:

/etc/rc.d/init.d/mariadb55-mysqld start

and

/etc/rc.d/init.d/mariadb55-mysqld stop


Start/Stop MariaDB as a system service

Issue the following commands as root:

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S99mariadb55-mariadbd
chkconfig mariadb55-mysqld on
config set mariadb55-mysqld service
config setprop mariadb55-mysqld status enabled

The application will now automatically start at boot time as a system service.


Configure private/public access

If your SME Server is hosting the application and is being accessed by other hosts either locally (LAN) or remotely (WAN) the ports and access privileges need to be set. For this issue the following commands (where 3307 is the port that MariaDB can be reached on as set in my.conf above - please check if this port is already in use e.g mysql55 from SCL):

config setprop mariadb55-mysqld TCPPort 3307
config setprop mariadb55-mysqld UDPPort 3307
config setprop mariadb55-mysqld access private

followed by the event to update the firewall rules:

signal-event remoteaccess-update

You can toggle between private and public access followed by the remoteaccess-update command.


Other articles in this category

PHP Software Collections, Software Collections, Software Collections Repositories, Software Collections:MariaDB, Software Collections:MongoDB, Software Collections:MySQL, Software Collections:MySQL55, Software Collections:MySQL57, Software Collections:Nodejs, Software Collections:PHP, Software Collections:PostgreSQL, Software Collections:Python, Software Collections:Ruby on Rails