This plugin is required for cleaners functionality and the optimization of some SQL queries.

The installation is slightly different for the master and slave servers.

For the master we have to provide access to clients data storage.

Installation CentOS

Master Server CentOS

cp /home/jtel/shared/JTELCarrierPortal/Libraries/jtel_udf_lib/jtel_udf_lib.so /usr/lib64/mysql/plugin/
chown root:root /usr/lib64/mysql/plugin/jtel_udf_lib.so
chmod 755 /usr/lib64/mysql/plugin/jtel_udf_lib.so
chcon system_u:object_r:lib_t:s0  /usr/lib64/mysql/plugin/jtel_udf_lib.so
semodule -r mysqld_unlink >/dev/null 2>&1
semodule -i /home/jtel/shared/JTELCarrierPortal/Libraries/jtel_udf_lib/mysqld_unlink.pp

Slave Server CentOS

cp /home/jtel/shared/JTELCarrierPortal/Libraries/jtel_udf_lib/jtel_udf_lib.so /usr/lib64/mysql/plugin/
chown root:root /usr/lib64/mysql/plugin/jtel_udf_lib.so
chmod 755 /usr/lib64/mysql/plugin/jtel_udf_lib.so
chcon system_u:object_r:lib_t:s0  /usr/lib64/mysql/plugin/jtel_udf_lib.so

Installation Debian

Master Server Debian

cp /home/jtel/shared/JTELCarrierPortal/Libraries/jtel_udf_lib/jtel_udf_lib.so /usr/lib/mysql/plugin/
chown root:root /usr/lib/mysql/plugin/jtel_udf_lib.so
chmod 755 /usr/lib/mysql/plugin/jtel_udf_lib.so

Slave Server Debian

cp /home/jtel/shared/JTELCarrierPortal/Libraries/jtel_udf_lib/dummy/jtel_udf_lib.so /usr/lib/mysql/plugin/
chown root:root /usr/lib/mysql/plugin/jtel_udf_lib.so
chmod 755 /usr/lib/mysql/plugin/jtel_udf_lib.so

Configuration

Important

The plugin must be installed/copied to all servers before the following configuration steps are performed.

The CREATE FUNCTION call will be replicated to the slaves, and will break the replication if the plugin is missing on the slave when replication is active.

To configure the plugin, the following commands are executed:

  • If replication is setup, then only perform this on one master server
  • If replication is not setup, then this must be performed on all servers.

CAUTION PASSWORD

mysql -u root -p<password> -v -e"
DROP FUNCTION IF EXISTS jt_max;
DROP FUNCTION IF EXISTS jt_first_id;
DROP FUNCTION IF EXISTS jt_last_id;
DROP FUNCTION IF EXISTS jt_first_integer;
DROP FUNCTION IF EXISTS jt_last_integer;
DROP FUNCTION IF EXISTS jt_last_string;
DROP FUNCTION IF EXISTS jt_first_string;
DROP FUNCTION IF EXISTS jt_parameter_size;
DROP FUNCTION IF EXISTS jt_mysql_log;
DROP FUNCTION IF EXISTS jt_file_unlink;
DROP FUNCTION IF EXISTS jt_file_stat;"

mysql -u root -p<password> -v -e"
CREATE AGGREGATE FUNCTION jt_max RETURNS STRING SONAME 'jtel_udf_lib.so';
CREATE AGGREGATE FUNCTION jt_first_integer RETURNS INTEGER SONAME 'jtel_udf_lib.so';
CREATE AGGREGATE FUNCTION jt_first_string RETURNS STRING SONAME 'jtel_udf_lib.so';
CREATE AGGREGATE FUNCTION jt_last_integer RETURNS INTEGER SONAME 'jtel_udf_lib.so';
CREATE AGGREGATE FUNCTION jt_last_string RETURNS STRING SONAME 'jtel_udf_lib.so';
CREATE FUNCTION jt_parameter_size RETURNS INTEGER SONAME 'jtel_udf_lib.so';
CREATE FUNCTION jt_mysql_log RETURNS STRING SONAME 'jtel_udf_lib.so';
CREATE FUNCTION jt_file_unlink RETURNS INTEGER SONAME 'jtel_udf_lib.so';
CREATE FUNCTION jt_file_stat RETURNS STRING SONAME 'jtel_udf_lib.so';"

Mysql Access to File System

The cleaner processes which run in the mysql database context must be provided access to the file share. 

usermod -a -G jtel mysql 

Add write directory permission to mounted jtel/share (mode=0755 → mode=0775). 

//acd-store/shared    /home/jtel/shared    cifs    user=jtel,password=<password>,uid=jtel,gid=jtel,file_mode=0775,dir_mode=0775    0    0
  • No labels