Az első példány telepítése

  • Beküldve: 2016. január 07, 13:03
  • Szerző: Bolemányi Attila

Az első MariaDB példányt a már megszokott módon fogjuk feltelepíteni. Ha külön nem említem, jelszóként mindenhol a 'Pa$$w0rd' karaktersorozatot használom fel.

apt-get install software-properties-common
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
add-apt-repository 'deb [arch=amd64,i386] http://ftp.bme.hu/pub/mirrors/mariadb/repo/10.1/debian jessie main'
apt-get update
apt-get install mariadb-server

Ellenőrizzük le a kiszolgáló telepítését, futását:

systemctl status mysql

Az eredmény pedig, ha minden rendben van, valami ehhez hasonló lesz:

● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (running) since Thu 2016-01-07 09:41:30 CET; 2min 32s ago
   CGroup: /system.slice/mysql.service
           ├─5871 /bin/bash /usr/bin/mysqld_safe
           ├─6081 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-err...
           └─6082 logger -t mysqld -p daemon.error

Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: mysql.time_zone_name                               OK
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: mysql.time_zone_transition                         OK
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: mysql.time_zone_transition_type                    OK
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: mysql.user                                         OK
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: Phase 2/6: Fixing views
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: Processing databases
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: information_schema
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: mysql
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: performance_schema
Jan 07 09:41:31 jessie /etc/mysql/debian-start[6136]: Phase 3/6: Running 'mysql_fix_privilege_tables'

Vagyis az első példányunk köszöni, jól van, és hiba nélkül ellátja feladatait. Helyezzük biztonságba az adatbázis-kiszolgálónkat:

mysql_secure_installation

A válaszok pedig:

Change root password: n
Remove anonymous users: Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y

Helyezzük át a datadir mappát a /srv/db/mysql alá:

systemctl stop mysql
mkdir /srv/db/mysql
chown mysql:mysql /srv/db/mysql
mv /var/lib/mysql/* /srv/db/mysql

A /etc/mysql/my.cnf fájlban az alábbi sort:

datadir     = /var/lib/mysql

módosítsuk erre:

datadir     = /srv/db/mysql

Indítsuk el ismét a MariaDB kiszolgálónkat:

systemctl start mysql

Ellenőrizzük le, hogy minden rendben van-e:

systemctl status mysql

Az eredmény:

● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (running) since Thu 2016-01-07 09:51:23 CET; 31s ago
  Process: 6260 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 6328 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mysql.service
           ├─6352 /bin/bash /usr/bin/mysqld_safe
           ├─6562 /usr/sbin/mysqld --basedir=/usr --datadir=/srv/db/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-erro...
           └─6563 logger -t mysqld -p daemon.error

Jan 07 09:51:23 jessie mysqld[6563]: 2016-01-07  9:51:23 140121609307904 [Note] InnoDB: Dumping buffer pool(s) not yet started
Jan 07 09:51:23 jessie mysqld[6563]: 2016-01-07  9:51:23 140122376046528 [Note] Plugin 'FEEDBACK' is disabled.
Jan 07 09:51:23 jessie mysqld[6563]: 2016-01-07  9:51:23 140122376046528 [Note] Server socket created on IP: '127.0.0.1'.
Jan 07 09:51:23 jessie mysqld[6563]: 2016-01-07  9:51:23 140122376046528 [Note] Reading of all Master_info entries succeded
Jan 07 09:51:23 jessie mysqld[6563]: 2016-01-07  9:51:23 140122376046528 [Note] Added new Master_info '' to hash table
Jan 07 09:51:23 jessie mysqld[6563]: 2016-01-07  9:51:23 140122376046528 [Note] /usr/sbin/mysqld: ready for connections.
Jan 07 09:51:23 jessie mysqld[6563]: Version: '10.1.10-MariaDB-1~jessie-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  ...ribution
Jan 07 09:51:23 jessie mysql[6328]: Starting MariaDB database server: mysqld.
Jan 07 09:51:23 jessie mysql[6328]: Checking for corrupt, not cleanly closed and upgrade needing tables..
Jan 07 09:51:23 jessie /etc/mysql/debian-start[6617]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored

A /var/log/syslog tanusága szerint pedig:

Jan  7 09:51:22 jessie mysqld_safe: Starting mysqld daemon with databases from /srv/db/mysql
Jan  7 09:51:22 jessie mysqld: 2016-01-07  9:51:22 140122376046528 [Note] /usr/sbin/mysqld (mysqld 10.1.10-MariaDB-1~jessie-log) starting as process 6562 ...
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Using mutexes to ref count buffer pool pages
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: The InnoDB memory heap is disabled
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Memory barrier is not used
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Compressed tables use zlib 1.2.8
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Using Linux native AIO
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Using generic crc32 instructions
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Initializing buffer pool, size = 256.0M
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Completed initialization of buffer pool
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Highest supported file format is Barracuda.
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: 128 rollback segment(s) are active.
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB: Waiting for purge to start
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.26-76.0 started; log sequence number 1616975
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140121609307904 [Note] InnoDB: Dumping buffer pool(s) not yet started
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] Plugin 'FEEDBACK' is disabled.
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] Server socket created on IP: '127.0.0.1'.
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] Reading of all Master_info entries succeded
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] Added new Master_info '' to hash table
Jan  7 09:51:23 jessie mysqld: 2016-01-07  9:51:23 140122376046528 [Note] /usr/sbin/mysqld: ready for connections.
Jan  7 09:51:23 jessie mysqld: Version: '10.1.10-MariaDB-1~jessie-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
Jan  7 09:51:23 jessie mysql[6328]: Starting MariaDB database server: mysqld.
Jan  7 09:51:23 jessie mysql[6328]: Checking for corrupt, not cleanly closed and upgrade needing tables..
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6614]: Upgrading MySQL tables if necessary.
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6617]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6617]: Looking for 'mysql' as: /usr/bin/mysql
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6617]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6617]: This installation of MySQL is already upgraded to 10.1.10-MariaDB, use --force if you still need to run mysql_upgrade
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6624]: Checking for insecure root accounts.
Jan  7 09:51:23 jessie /etc/mysql/debian-start[6628]: Triggering myisam-recover for all MyISAM tables

Vagyis minden rendben működik, az első adatbázis-kiszolgáló példányunk készen van (vagyis csak majdnem).