2013
02.15

Afin de tester la nouvelle version de Mysql 5.6 , j’ai voulu l’installer sur une nouvelle VZ basée , comme d’habitude sur un template debian.
Si la partie OpenVZ ne vous intéresse , allez directement au §2 !
1. Création et configuration VZ
2. Instllation MySQL5.6
3. Ajout de plugin MySQL
Pour la créer je définie :
– son nom ( nivea OpenVZ )
– son hostname
– son template
– le type de réseau ( voir VETH et non venet car je trouve cela plus pratique.
– la taille du disque

vzctl create 106 --name MYSQL5.6 --ostemplate debian-6.0-x86 --hostname debianVir6-MYSQL56
vzctl set 106 --nameserver 192.168.1.254 --save
vzctl set 106 --netif_add eth0 --save
vzctl set 106 --diskspace 2G --save

 

1. Configuration du réseau de la VZ 106


debianServeur@root:/root $vzctl start 106
Starting container ...
Container is mounted
Setting CPU units: 1000
Set hostname: debianVir6-MYSQL56
File resolv.conf was modified
Configure veth devices: veth106.0
Container start in progress...
debianServeur@root:/root $ifconfig veth106.0 0
debianServeur@root:/root $ip route add 192.168.1.206 dev veth106.0
debianServeur@root:/root $vzctl enter 106
entered into CT 106
root@debianVir6-MYSQL56:/# cat /etc/network/interfaces

#j‘ajoute mon reseau veneth et la route vers l’ip de mon VETH HOTE
auto eth0
iface eth0 inet static
address 192.168.1.206
netmask 255.255.255.255
up /sbin/ip route add 192.168.1.46 dev eth0
up /sbin/ip route add default via 192.168.1.46

root@debianVir6-MYSQL56:/# exit

Sur mon serveur HOTE, j’ajoute les regles de la carte reseau VETH6.
Et je modifie la conf de ma VZ pour que la route soit automatiquement monté sur le serveur HOTE

debianServeur@root:/root $echo 1 > /proc/sys/net/ipv4/conf/veth106.0/proxy_arp
debianServeur@root:/root $cat /etc/vz/conf/106.mount

#!/bin/bash
# This script source VPS configuration files in the same order as vzctl does
# if one of these files does not exist then something is really broken
[ -f /etc/vz/vz.conf ] || exit 1
[ -f $VE_CONFFILE ] || exit 1
# source both files. Note the order, it is important
. /etc/vz/vz.conf
. $VE_CONFFILE
# Configure veth with IP after VPS has started
{
IP=192.168.1.206
DEV=veth106.0
while sleep 1; do
/sbin/ifconfig $DEV 0 >/dev/null 2>&1
if [ $? -eq 0 ]; then
/sbin/ip route add $IP dev $DEV
break
fi
done
} &

debianServeur@root:/root $chmod +x /etc/vz/conf/106.mount

Si tout est OK niveau réseau, le ping doit passer sur la VZ après redémarrage.

debianServeur@root:/root $vzctl restart 106
Restarting container
Stopping container ...
Container was stopped
Container is unmounted
Starting container ...
Container is mounted
Setting CPU units: 1000
Set hostname: debianVir6-MYSQL56
File resolv.conf was modified
Configure veth devices: veth106.0
Container start in progress...
debianServeur@root:/root $ping 192.168.1.206
PING 192.168.1.206 (192.168.1.206) 56(84) bytes of data.
64 bytes from 192.168.1.206: icmp_req=1 ttl=64 time=0.089 ms

Pour pouvoir installer mysql5.6, il faut un bon nombre de ram alloué à la VZ

vzctl set 106 --privvmpages 420m:450m --save

 

2. Installation de MySQL 5.6

On crée l’utilisateur MySQL sur la VZ

root@debianVir6-MYSQL56:/# groupadd mysql
root@debianVir6-MYSQL56:/# useradd -g mysql mysql

On récupère le packet debian de mysql5.6 , on installe le packet libaio nécessaire à l’installation de mysql5.6 et on installe mysql.

root@debianVir6-MYSQL56:# wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10-debian6.0-i686.deb
--2013-02-15 16:01:35-- http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10-debian6.0-i686.deb
Resolving cdn.mysql.com... 46.33.75.170, 46.33.75.186
Connecting to cdn.mysql.com|46.33.75.170|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 289080976 (276M) [application/x-debian-package]
Saving to: `mysql-5.6.10-debian6.0-i686.deb'

100%[===================================================================================================================>] 289,080,976 1.92M/s in 2m 23s

2013-02-15 16:03:58 (1.93 MB/s) – `mysql-5.6.10-debian6.0-i686.deb’ saved [289080976/289080976]
root@debianVir6-MYSQL56:# aptitude install libaio1
The following NEW packages will be installed:
libaio1
0 packages upgraded, 1 newly installed, 0 to remove and 28 not upgraded.
Need to get 7772 B of archives. After unpacking 73.7 kB will be used.
Get:1 http://ftp.debian.org/debian/ squeeze/main libaio1 i386 0.3.107-7 [7772 B]
Fetched 7772 B in 0s (42.6 kB/s)
Selecting previously deselected package libaio1.
(Reading database … 22988 files and directories currently installed.)
Unpacking libaio1 (from …/libaio1_0.3.107-7_i386.deb) …
Setting up libaio1 (0.3.107-7) …

root@debianVir6-MYSQL56:~# dpkg -i mysql-5.6.10-debian6.0-i686.deb
Selecting previously deselected package mysql.
(Reading database … 22996 files and directories currently installed.)
Unpacking mysql (from mysql-5.6.10-debian6.0-i686.deb) …
Setting up mysql (5.6.10) …

L’installation se fait par défaut dans /opt/mysql/server-5.6/.
Maintenant on va installer mysql5.6 en indiquant l’utilisateur mysql.

root@debianVir6-MYSQL56:/opt/mysql/server-5.6# scripts/mysql_install_db --user=mysql

Installing MySQL system tables...2013-02-15 16:10:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-02-15 16:10:45 492 [Note] InnoDB: The InnoDB memory heap is disabled
2013-02-15 16:10:45 492 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-02-15 16:10:45 492 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-02-15 16:10:45 492 [Note] InnoDB: CPU does not support crc32 instructions
2013-02-15 16:10:45 492 [Note] InnoDB: Using Linux native AIO
2013-02-15 16:10:45 492 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-02-15 16:10:45 492 [Note] InnoDB: Completed initialization of buffer pool
2013-02-15 16:10:45 492 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-02-15 16:10:45 492 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-02-15 16:10:45 492 [Note] InnoDB: Database physically writes the file full: wait...
2013-02-15 16:10:46 492 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-02-15 16:10:47 492 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-02-15 16:10:48 492 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-02-15 16:10:48 492 [Warning] InnoDB: New log files created, LSN=45781
2013-02-15 16:10:48 492 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-02-15 16:10:49 492 [Note] InnoDB: Doublewrite buffer created
2013-02-15 16:10:49 492 [Note] InnoDB: 128 rollback segment(s) are active.
2013-02-15 16:10:49 492 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-02-15 16:10:49 492 [Note] InnoDB: Foreign key constraint system tables created
2013-02-15 16:10:49 492 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-02-15 16:10:49 492 [Note] InnoDB: Tablespace and datafile system tables created.
2013-02-15 16:10:49 492 [Note] InnoDB: Waiting for purge to start
2013-02-15 16:10:49 492 [Note] InnoDB: 1.2.10 started; log sequence number 0
2013-02-15 16:10:54 492 [Note] Binlog end
2013-02-15 16:10:54 492 [Note] InnoDB: FTS optimize thread exiting.
2013-02-15 16:10:54 492 [Note] InnoDB: Starting shutdown...
2013-02-15 16:10:56 492 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2013-02-15 16:10:56 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-02-15 16:10:56 515 [Note] InnoDB: The InnoDB memory heap is disabled
2013-02-15 16:10:56 515 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-02-15 16:10:56 515 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-02-15 16:10:56 515 [Note] InnoDB: CPU does not support crc32 instructions
2013-02-15 16:10:56 515 [Note] InnoDB: Using Linux native AIO
2013-02-15 16:10:56 515 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-02-15 16:10:56 515 [Note] InnoDB: Completed initialization of buffer pool
2013-02-15 16:10:56 515 [Note] InnoDB: Highest supported file format is Barracuda.
2013-02-15 16:10:56 515 [Note] InnoDB: 128 rollback segment(s) are active.
2013-02-15 16:10:56 515 [Note] InnoDB: Waiting for purge to start
2013-02-15 16:10:56 515 [Note] InnoDB: 1.2.10 started; log sequence number 1625977
2013-02-15 16:10:57 515 [Note] Binlog end
2013-02-15 16:10:57 515 [Note] InnoDB: FTS optimize thread exiting.
2013-02-15 16:10:57 515 [Note] InnoDB: Starting shutdown...
2013-02-15 16:10:58 515 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/server-5.6/bin/mysqladmin -u root password 'new-password'
/opt/mysql/server-5.6/bin/mysqladmin -u root -h debianVir6-MYSQL56 password 'new-password'
Alternatively you can run:
/opt/mysql/server-5.6/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/mysql/server-5.6 ; /opt/mysql/server-5.6/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /opt/mysql/server-5.6/bin/mysqlbug script!
The latest information about MySQL is available on the web at http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /opt/mysql/server-5.6/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings


Voila notre nouveau seveur Mysql5.6 est installé.
On va changer les droits du répertoire data où se trouvent les données MySQL

root@debianVir6-MYSQL56:/opt/mysql/server-5.6# chown -R mysql data

On met le nouveau lanceur mysql.server dans /etc/init.d
root@debianVir6-MYSQL56:/opt/mysql/server-5.6#cp support-files/mysql.server /etc/init.d/mysql.server
Et on peut directement le démarrer pour voir si ça marche :
root@debianVir6-MYSQL56:/opt/mysql/server-5.6#/etc/init.d/mysql.server start
Starting MySQL..

Notre serveur a démarré correctement. Afin de pouvoir utilisé facilement les commandes mysql, nous allons les ajouter via un lien symbolique dans /usr/local/bin

root@debianVir6-MYSQL56:/opt/mysql/server-5.6#ls -l /usr/local/bin/
total 0
root@debianVir6-MYSQL56:/opt/mysql/server-5.6# ln -s /opt/mysql/server-5.6/bin/* /usr/local/bin/
root@debianVir6-MYSQL56:/opt/mysql/server-5.6# ls /usr/local/bin/
innochecksum mysql mysql_find_rows mysql_waitpid mysqlcheck mysqlhotcopy replace
msql2mysql mysql_client_test mysql_fix_extensions mysql_zap mysqld mysqlimport resolve_stack_dump
my_print_defaults mysql_client_test_embedded mysql_plugin mysqlaccess mysqld-debug mysqlshow resolveip
myisam_ftdump mysql_config mysql_secure_installation mysqlaccess.conf mysqld_multi mysqlslap
myisamchk mysql_config_editor mysql_setpermission mysqladmin mysqld_safe mysqltest
myisamlog mysql_convert_table_format mysql_tzinfo_to_sql mysqlbinlog mysqldump mysqltest_embedded
myisampack mysql_embedded mysql_upgrade mysqlbug mysqldumpslow perror

Avant de se connecter à notre nouveau serveur via root, avant il faut définir sont mot de passe :

root@debianVir6-MYSQL56:/opt/mysql/server-5.6#mysqladmin -u root password 'new-password'
root@debianVir6-MYSQL56:/opt/mysql/server-5.6# mysql -h localhost -u root -pnew-password
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show plugins;

+----------------------------+----------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+----------------------------+----------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INSERTED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_DATAFILES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
+----------------------------+----------+--------------------+---------+---------+
43 rows in set (0.01 sec)

Pour finir on va faire en sorte que le serveur MySQL démarre automatiquement :
root@debianVir6-MYSQL56:/opt/mysql/server-5.6#update-rc.d mysql.server defaults
update-rc.d: using dependency based boot sequencing

Et voilà c’est installé.
Attention, il faut avoir au moins 400M de RAM attribué à la VZ pour installer MySQL5.3.
Vous pouvez maintenant jouer avec toutes ces nouvelles fonctionnalitées !
 

3. Ajout de plugins

Pour ajouter des plugins ( comme le plugin memcached ) :
Pacez vous dans /opt/mysql/server-5.6 et lancer les commandes :
root@debianVir6-MYSQL56:/opt/mysql/server-5.6#mysql -u root -p < share/innodb_memcached_config.sql
root@debianVir6-MYSQL56:/opt/mysql/server-5.6#mysql -u root -p
mysql>INSTALL PLUGIN daemon_memcached SONAME ‘libmemcached.so’;

Aucun commentaire.

Ajoutez votre commentaire

%d blogueurs aiment cette page :