Sponsored Content
Special Forums UNIX and Linux Applications Configuring mysql for multiple instance only Post 302938304 by jcdole on Saturday 14th of March 2015 04:48:19 AM
Old 03-14-2015
Configuring mysql for multiple instance only

Hello.
I plan to use mysql with only instance database so I can stop one database for maintenance without stopping every thing.

When one reads through the my.cnf config file, it is not clear if we must use at the same time a single database mysql plus any instances mysqld2 (for app1), mysqld3 (for app2), and so on.

Or may I get rid of the mysqld process and start only mysqld2, mysqld3, ....
I have try that but could not start any instance. Of course I have configured a systemd service file.

Or may I use mysqld1 as mysql database pointing to mysql as first mandatory database and then add more instance when necessary.

here code for mysqld@.service
Code:
[Unit]
Description=MySQL Multi Server for instance %i
After=syslog.target
After=network.target

[Service]
User=mysql
Group=mysql
Type=forking
ExecStart=/usr/bin/mysqld_multi --defaults-file=/etc/mysql/cfg_%i.cnf  --log=/var/log/mysql/mysql_multi.log --verbose  start %i
ExecStop=/usr/bin/mysqld_multi --log=/var/log/mysql/mysql_multi.log  stop %i
#Restart=always
#RestartSec=5
PrivateTmp=true

[Install]
WantedBy=multi-user.target

my config file in /etc/my.cnf
Code:
[client]
port       = 3306
socket     = /bdd/bd_1/sock/mysql_cli.sock

[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log        = /var/log/mysqld_multi.log

[mysqld2]
port       = 63332
datadir    = /bdd/bd_2/app2
pid-file   = /bdd/bd_2/app2/mysqld.pid
socket     = /bdd/bd_2/app2/mysql.sock
user       = mysql

[mysqld3]
port       = 63333
datadir    = /bdd/bd_3/app3
pid-file   = /bdd/bd_2/app3/mysqld.pid
socket     = /bdd/bd_2/app3/mysql.sock
user       = mysql

!includedir /etc/my.cnf.d

I would like some advise.

Any help is welcome.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multiple PHP sessions within the same browser instance

Dear all..... I am currently writing a Help-Desk / Knowledge Base application using PHP/PostGreSQL. I authenticate the user using a quite elaborate mechanism of cookies. The problem is that using cookies (I also have a version using sessions with the same problem), I can only seem to get one... (4 Replies)
Discussion started by: zazzybob
4 Replies

2. UNIX for Dummies Questions & Answers

Multiple instance of same process

;)Hi Everyone, I am using solaris 5.10. I have a java process running in server mode in unix. The problem is that it automatically forks i.e creates a child process. I mean suddenly two instances of that process start running , in which the process-id of first instance is the parent... (0 Replies)
Discussion started by: glamo_2312
0 Replies

3. UNIX for Advanced & Expert Users

Multiple Instance Of Same Process

Hi Everyone, I am using solaris 5.10. I have a java process running in server mode in unix. The problem is that it automatically forks i.e creates a child process. I mean suddenly two instances of that process start running , in which the process-id of first instance is the parent... (5 Replies)
Discussion started by: glamo_2312
5 Replies

4. Shell Programming and Scripting

Help with multiple instance script checking

I am trying to debug the following script. It appears that when the check for script running occurs, it's finding the actual grep statement and causing the script believe the script is already running. This is deployed on two different servers where one works fine, the other doesn't. Any ideas? ... (2 Replies)
Discussion started by: DaddyMoose
2 Replies

5. UNIX for Advanced & Expert Users

Multiple Instance of Unix Shell Script

Hi All, I have a problem mentioned below. I have a script which performs line by line operations on several files. I have a temp_file storing the list of names of the file to be validated. Right not in while loop i validate these files one by one. Is there anyway that i can modify... (1 Reply)
Discussion started by: amitaryans
1 Replies

6. Shell Programming and Scripting

A script that spawns multiple instance of itself.

Hi all,I have some questions of forking new process,the code is below.Any help will be appreciated. 1 #! /bin/bash 2 3 PIDS=$(pidof sh $0) 4 P_array=( $PIDS ) 5 echo $PIDS 6 let "instances = ${#P_array}-1" 7 8 echo "$instances instance(s)" of this script running." 9... (4 Replies)
Discussion started by: homeboy
4 Replies

7. Shell Programming and Scripting

Multiple instance in tomcat

I need to install a tomcat6 with multiple instances like instance1,instance2 and instance3 in a server. I came to know that for that we need to install tomcat6,apache2.0,mod_jk1.2 and jre with tools.jar installed.And we need to create multiple instances with same web.xml and difference... (0 Replies)
Discussion started by: tuxslonik
0 Replies

8. Shell Programming and Scripting

No lock file: Preventing multiple instance of a script

I've been bitten by using a lock or pid file to prevent multiple instances of a script. A user typed kill -9, and the pid file didn't go away. You can't trap -9. So when he tried to restart, it said "already running", and I got trouble report. Argh. So here's what we came up with: # Stop if... (1 Reply)
Discussion started by: McFadden586
1 Replies

9. AIX

Configuring MySQL problem

Hi, Trying to setup mediawiki on a system but having problems configuring mysql: CC=/usr/bin ./configure checking build system type... powerpc-ibm-aix6.1.0.0 checking host system type... powerpc-ibm-aix6.1.0.0 checking target system type... powerpc-ibm-aix6.1.0.0 checking for a... (9 Replies)
Discussion started by: vpundit
9 Replies

10. Red Hat

configuring MYsql db on redhat cluster

Hello, can someone please suggest me in configuring the mysql db on redhat cluster, I have few questions. 1. where do I have to configure heart beat links, and is there any file in the redhat cluster that we update it to use these ipaddress and these interface on the node. 2. I am configuring... (0 Replies)
Discussion started by: bobby320
0 Replies
OCF_HEARTBEAT_MYSQL(7)						OCF resource agents					    OCF_HEARTBEAT_MYSQL(7)

NAME
ocf_heartbeat_mysql - Manages a MySQL database instance SYNOPSIS
mysql [start | stop | status | monitor | promote | demote | meta-data | validate-all] DESCRIPTION
Resource script for MySQL. May manage a standalone MySQL database, a clone set with externally managed replication, or a complete master/slave replication setup. While managing replication, the default behavior is to use uname -n values in the change master to command. Other IPs can be specified manually by adding a node attribute ${INSTANCE_ATTR_NAME}_mysql_master_IP giving the IP to use for replication. For example, if the mysql primitive you are using is p_mysql, the attribute to set will be p_mysql_mysql_master_IP. SUPPORTED PARAMETERS
binary Location of the MySQL server binary (optional, string, default "/usr/bin/safe_mysqld") client_binary Location of the MySQL client binary (optional, string, default "mysql") config Configuration file (optional, string, default "/etc/my.cnf") datadir Directory containing databases (optional, string, default "/var/lib/mysql") user User running MySQL daemon (optional, string, default "mysql") group Group running MySQL daemon (for logfile and directory permissions) (optional, string, default "mysql") log The logfile to be used for mysqld. (optional, string, default "/var/log/mysqld.log") pid The pidfile to be used for mysqld. (optional, string, default "/var/run/mysql/mysqld.pid") socket The socket to be used for mysqld. (optional, string, default "/var/lib/mysql/mysql.sock") test_table Table to be tested in monitor statement (in database.table notation) (optional, string, default "mysql.user") test_user MySQL test user, must have select privilege on test_table (optional, string, default "root") test_passwd MySQL test user password (optional, string, no default) enable_creation If the MySQL database does not exist, it will be created (optional, boolean, default 0) additional_parameters Additional parameters which are passed to the mysqld on startup. (e.g. --skip-external-locking or --skip-grant-tables) (optional, string, no default) replication_user MySQL replication user. This user is used for starting and stopping MySQL replication, for setting and resetting the master host, and for setting and unsetting read-only mode. Because of that, this user must have SUPER, REPLICATION SLAVE, REPLICATION CLIENT, and PROCESS privileges on all nodes within the cluster. Mandatory if you define a master-slave resource. (optional, string, no default) replication_passwd MySQL replication password. Used for replication client and slave. Mandatory if you define a master-slave resource. (optional, string, no default) replication_port The port on which the Master MySQL instance is listening. (optional, string, default "3306") max_slave_lag The maximum number of seconds a replication slave is allowed to lag behind its master. Do not set this to zero. What the cluster manager does in case a slave exceeds this maximum lag is determined by the evict_outdated_slaves parameter. (optional, integer, default 3600) evict_outdated_slaves If set to true, any slave which is more than max_slave_lag seconds behind the master has its MySQL instance shut down. If this parameter is set to false in a primitive or clone resource, it is simply ignored. If set to false in a master/slave resource, then exceeding the maximum slave lag will merely push down the master preference so the lagging slave is never promoted to the new master. (optional, boolean, default false) reader_attribute An attribute that the RA can manage to specify whether a node can be read from. This node attribute will be 1 if it's fine to read from the node, and 0 otherwise (for example, when a slave has lagged too far behind the master). A typical example for the use of this attribute would be to tie a set of IP addresses to MySQL slaves that can be read from. This parameter is only meaningful in master/slave set configurations. (unique, optional, string, default "readable") SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 120. stop Stops the resource. Suggested minimum timeout: 120. status Performs a status check. Suggested minimum timeout: 60. monitor Performs a detailed status check. Suggested minimum timeout: 30. Suggested interval: 20. monitor (Master role) Performs a detailed status check. Suggested minimum timeout: 30. Suggested interval: 10. monitor (Slave role) Performs a detailed status check. Suggested minimum timeout: 30. Suggested interval: 30. promote Promotes the resource to the Master role. Suggested minimum timeout: 120. demote Demotes the resource to the Slave role. Suggested minimum timeout: 120. notify Suggested minimum timeout: 90. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a mysql resource using the crm(8) shell: primitive p_mysql ocf:heartbeat:mysql op monitor depth="0" timeout="30" interval="20" op monitor role="Master" depth="0" timeout="30" interval="10" op monitor role="Slave" depth="0" timeout="30" interval="30" ms ms_mysql p_mysql meta notify="true" interleave="true" SEE ALSO
http://www.linux-ha.org/wiki/mysql_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 06/09/2014 OCF_HEARTBEAT_MYSQL(7)
All times are GMT -4. The time now is 09:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy