Setup lamp server
来源:互联网 发布:知乎 高中 书包 编辑:程序博客网 时间:2024/04/28 00:13
Setup lamp server
Contents
[hide]
· 1 env
· 2 Open SSL
· 3 stow
· 4 httpd
· 5 zlib
· 6 GNU M4
· 7 Bison
· 8 cmake
· 9 mysql-5.5.x with cmake
· 10 mysql
· 11 libxml
· 12 gd
· 13 imap
· 14 php
· 15 phpMyAdmin
· 16 dotproject
· 17 mysql replication
[edit] env
mkdir -p /local/tools cd /local/tools mkdir repository mkdir sources
[edit] Open SSL
tar -zxf /data/download/openssl-0.9.8i.tar.gz
cd /data/tools/source/openssl-0.9.8i
./config --prefix=/data/tools/repository/openssl
/data/tools/bin/openssl genrsa -des3 -rand /data/download/mysql-5.0.91.tar.gz:/data/download/httpd-2.2.17.tar.gz -out localhost.key 1024
/data/tools/bin/openssl rsa -in localhost.key -out localhost.key.unsecure
/data/tools/bin/openssl req -new -key localhost.key -out localhost.key.csr
/data/tools/bin/openssl x509 -req -days 30 -in localhost.key.csr -signkey localhost.key -out localhost.cert
chmod 400 localhost.cert
chmod 400 localhost.key
chmod 400 localhost.key.unsecure
[edit] stow
cd /data/tools/sources tar -zxf /data/archives/stow-1.3.3.tar.gz cd stow-1.3.3 ./configure --prefix=/data/tools/repository/stow-1.3.3 make make install cd /data/tools/repository/stow-1.3.3 chmod -R 755 . cd .. ./stow-1.3.3/bin/stow stow-1.3.3
[edit] httpd
cd /local/tools/sources
tar -zxf /data/archive/httpd-2.2.4.tar.gz
For bz2 file: tar xvjf /data/archives/httpd-2.2.17.tar.bz2
cd httpd-2.2.0
CFLAGS="-O2" ./configure --prefix=/data/tools/repository/httpd-2.2.17 -enable-rewrite=shared --enable-so --enable-cgi --enable-info --enable-http --enable-proxy --enable-authn-alias --enable-authz-owner --enable-auth-digest --enable-dbd --enable-mime-magic --enable-ident --enable-authn-dbd --enable-ssl --enable-mods-shared=all --with-ssl=/data/tools --with-z=/data/tools --enable-deflate --with-mpm=prefork –with-ldap
make
make install
cd /data/tools/repository/httpd-2.2.17
chmod -R 755 .
chown -R httpd .
chgrp -R httpd .
cd ..
/data/tools/bin/stow httpd-2.2.17
cp /data/tools/bin/apachectl /etc/init.d/httpd
vi /data/tools/repository/httpd-2.2.17/conf/httpd.conf
1. Edit /local/tools/repository/httpd-2.2.17conf/httpd.conf
2. Modify line 66: User httpd
3. Modify line 67: Group httpd
4. Modify line 88: ServerAdmin raffi.semerciyan@tcl.com
5. Modify line 97: ServerName 172.24.46.41:80
6. Modify line 104: DocumentRoot "/local/www"
7. Modify line 131: <Directory "/local/www">
[edit] zlib
cd /data/tools/sources
tar -zxf /data/archives/zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/data/tools/repository/zlib-1.2.3
make
make install
cd /data/tools/repository/zlib-1.2.3
chmod -R 755 .
cd ..
/data/tools/bin/stow zlib-1.2.3
[edit] GNU M4
tar xzvf m4-latest.tar.gz
./configure --prefix=/data/tools/repository/m4-1.4.15
make
make install
cd /data/tools/repository/
/data/tools/bin/stow m4-1.4.15
mv /usr/bin/m4 /usr/bin/m4.backup
cp /data/tools/repository/m4-1.4.15/bin/m4 /usr/bin/m4
[edit] Bison
tar xzvf bison-2.4.3.tar.gz
./configure --prefix=/data/tools/repository/bison-2.4.3
make
make install
cd /data/tools/repository/
/data/tools/bin/stow bison-2.4.3
mv /usr/bin/bison /usr/bin/bison.backup
cp /data/tools/repository/bison-2.4.3/bin/bison /usr/bin/bison
[edit] cmake
tar xzvf cmake-2.8.4.tar.gz
./configure --prefix=/data/tools/repository/cmake-2.8.4
make
make install
cd /data/tools/repository/
/data/tools/bin/stow cmake-2.8.4
[edit] mysql-5.5.x with cmake
tar xzvf mysql-5.5.9.tar.gz
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" /data/tools/bin/cmake -DCMAKE_INSTALL_PREFIX=/data/tools/repository/mysql-5.5.9 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_UNIX_ADDR=/data/tools/repository/mysql-5.5.9/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DWITH_ZLIB=/data/tools -DMYSQL_TCP_PORT=3307
make
make install
cd /data/tools/repository/
/data/tools/bin/stow mysql-5.5.9
/data/tools/repository/mysql-5.5.9/scripts/mysql_install_db --user=mysql --datadir=/home/mysqldb --basedir=/data/tools/repository/mysql-5.5.9
[edit] mysql
cd /data/tools/sources
tar -zxf /data/archives/mysql-5.0.91.tar.gz
cd mysql-5.0.91
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/data/tools/mysql-5.0.91 --localstatedir=/data/mysqldb --with-unix-socket-path=/data/tools/mysql-5.0.91/tmp/mysql.sock --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-tcp-port=3306 --with-big-tables --with-isam --with-mysqld-user=mysql
make
make install
cd /data/tools/repository/mysql-5.0.91
mkdir etc
cp /data/tools/source/mysql-5.0.91/support-files/my-medium.cnf etc/my.cnf
cp /data/tools/sources/mysql-5.0.91/support-files/mysql.server /etc/init.d/mysql-5.0.91.server
vi /etc/init.d/mysql-5.5.9.server
1. <Edit /etc/init.d/mysql-5.0.91.server and change the following lines:
2. 74: PATH=$basedir/bin:/sbin:/usr/sbin:/bin:/usr/bin
3. 135: conf=$basedir/etc/my.cnf
4. >
chmod 777 /etc/init.d/mysql-5.0.91.server
find . -type d -exec chmod o+x {} \;
chmod -R o+r .
mkdir var tmp
chown mysql.mysql var tmp
chmod 777 var tmp
1. If you don't perform the following and if mysql cannot enter the /local/tools
2. directory, then you will encounter the following errors when installing the database.
3. ERROR: 1 Can't create/write to file '/data/tools/repository/mysql-5.0.90/var/mysql/db.MYI' (Errcode: 13)
chmod -R 755 /data/tools
./bin/mysql_install_db --user=mysql
/etc/init.d/mysql-5.5.9.server start
cd /data/tools/repository
/data/tools/bin/stow mysql-5.0.91
/data/tools/bin/mysql -h localhost -u root
1. mysql> DROP DATABASE test;
1. mysql> GRANT USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY 'Admin01ME!';
1. mysql> DELETE FROM mysql.user WHERE User=;
[edit] libxml
cd /local/tools/sources
tar -zxf /data/archives/libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
./configure --prefix=/data/tools/repository/libxml2-2.7.8
/bin/rm: cannot remove `libtoolT': No such file or directory
WTF??? if you have this problem, you can do: cp ./libtool ./libtoolT
./configure --prefix=/data/tools/repository/libxml2-2.7.8
make
make install
cd /data/tools/repository/libxml2-2.7.8
chmod -R 755 .
cd ..
/data/tools/bin/stow libxml2-2.7.8
[edit] gd
cd /data/tools/sources
tar -zxvf /data/archives/gd-2.0.36RC1.tar.gz
cd gd-2.0.33
./configure --prefix=/data/tools/repository/gd-2.0.36RC1
make
make install
cd /data/tools/repository/
../bin/stow gd-2.0.36RC1
[edit] imap
cd /data/tools/sources
tar -zxf /data/archives/imap-2007e.tar.gz
cd imap-2007e/
make lrh
cd /data/tools/lib
ln -s /data/tools/sources/imap-2007e/c-client/c-client.a .
cd /data/tools/include
ln -s /data/tools/sources/imap-2007e/c-client/c-client.h .
ln -s /data/tools/sources/imap-2007e/c-client/mail.h .
ln -s /data/tools/sources/imap-2007e/c-client/imap4r1.h .
ln -s /data/tools/sources/imap-2007e/c-client/osdep.h .
ln -s /data/tools/sources/imap-2007e/c-client/rfc822.h .
ln -s /data/tools/sources/imap-2007e/c-client/smtp.h .
ln -s /data/tools/sources/imap-2007e/c-client/nntp.h .
ln -s /data/tools/sources/imap-2007e/c-client/utf8.h .
ln -s /data/tools/sources/imap-2007e/c-client/utf8aux.h .
ln -s /data/tools/sources/imap-2007e/c-client/misc.h .
ln -s /data/tools/sources/imap-2007e/c-client/linkage.h .
ln -s /data/tools/sources/imap-2007e/c-client/env_unix.h .
ln -s /data/tools/sources/imap-2007e/c-client/fs.h .
ln -s /data/tools/sources/imap-2007e/c-client/nl.h .
ln -s /data/tools/sources/imap-2007e/c-client/tcp.h .
ln -s /data/tools/sources/imap-2007e/c-client/env.h .
ln -s /data/tools/sources/imap-2007e/c-client/ftl.h .
cd ../openldap-2.0.7
./configure --prefix=/data/tools/repository/ldap --enable-dns --enable-cldap --enable-ldapd --enable-wrappers --enable-phonetic --enable-passwd --enable-shell
make depend
make
make test
su root -c \make install\
[edit] php
cd /data/tools/source
tar -jxf /data/archives/php-5.3.3.tar.bz2
cd php-5.3.3
Because we didn't put the binaries at the official place, if you try to configure PHP, it will fails because of MySQL dynamic libraries. So you need to tell to the configuration where to find these MySQL libraries.
For example, if MySQL libraries are found in /data/tools/lib/mysql then you should define the LDFLAGS variable just BEFORE the configure:
export LDFLAGS="-lpthread -Wl,-R, /data/tools/repository/mysql-5.0.33/lib/mysql"
./configure --prefix=/data/tools/repository/php-5.3.3 --disable-debug --enable-session --with-regex=php --enable-debug=no --enable-magic-quotes --enable-mbstring --enable-safe-mode --enable-ctype --with-gettext --without-pear --disable-rpath --enable-wddx=shared --with-ttf --enable-gd-native-ttf --with-config-file-path=/data/tools/repository/php-5.3.3/etc --with-zlib-dir=/data/tools --with-libxml-dir=/data/tools --with-apxs2=/data/tools/repository/httpd-2.2.17/bin/apxs --with-mysql=/data/tools/repository/mysql-5.0.91/ --with-mysql-sock=/data/tools/repository/mysql-5.0.91/tmp/ --enable-cgi --enable-ldap
make
make install
[edit] phpMyAdmin
cd /local/www
tar -jxf /local/archive/phpMyAdmin-2.8.0.2.tar.bz2
cd phpMyAdmin-2.8.0.2
chmod 755 -R .
chown -R httpd .
chgrp -R httpd .
cat >/local/www/phpMyAdmin-2.8.0.2/config.inc.php <<EOF
<?php
/* Servers configuration */
$i = 0;
/* Server localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['socket'] = '/local/tools/tmp/mysql.sock';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'Admin01ME!';
/* End of servers configuration */
?>
EOF
chmod 770 /local/www/phpMyAdmin-2.8.0.2/config.inc.php
chown httpd /local/www/phpMyAdmin-2.8.0.2/config.inc.php
chgrp httpd /local/www/phpMyAdmin-2.8.0.2/config.inc.php
[edit] dotproject
cd /local/www
tar -zxf /local/archive/dotproject-v2.0.2.tar.gz
cd dotproject
chmod 755 -R .
chown -R httpd .
chgrp -R httpd .
[edit] mysql replication
We want to replicate a database named 'gisus' on 172.24.61.58 to a database named 'gisus' on 172.24.61.134, 172.24.3.244 and 172.24.61.17. We suppose we just installed mysql on each server.
1) In order to have no compatibilities problem, we will use the same MySQL version on all servers. 5.0.51a.
2) On the master server (172.24.61.58), we put a copy of the file /vobs/tools_gsus/gisusdb/gisus.sql (Clearcase) into /tmp.
semerci1@aclgcl46-041 ~ >ct setview tools_gsus_v0.1_dev_semerci1 semerci1@aclgcl46-041 VIEW tools_gsus_v0.1_dev_semerci1 ~ >cd /vobs/tools_gsus/gisusdb semerci1@aclgcl46-041 VIEW tools_gsus_v0.1_dev_semerci1 /vobs/tools_gsus/gisusdb >scp gisus.sql root@172.24.61.58:/tmp
3) Log in to the master server (172.24.61.58). In the following example, we suppose that you installed your public authentication key and that you have ssh-agent running on semerci1@aclgcl46-041 (that's why we don't need to type the password. If a password or passphrase is requested, then just type it).
semerci1@aclgcl46-041 ~ >ssh root@172.24.61.58 [root@aclgcl-058 ~]#
4) Initialize a new database, configure mysql and start the server.
[root@aclgcl-058 data]# /usr/local/mytools/repository/mysql-5.0.51a/bin/mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... 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: /usr/local/mytools/repository/mysql-5.0.51a/bin/mysqladmin -u root password 'new-password' /usr/local/mytools/repository/mysql-5.0.51a/bin/mysqladmin -u root -h aclgcl-058 password 'new-password'
Alternatively you can run: /usr/local/mytools/repository/mysql-5.0.51a/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 /usr/local/mytools/repository/mysql-5.0.51a ; /usr/local/mytools/repository/mysql-5.0.51a/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 /usr/local/mytools/repository/mysql-5.0.51a/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 [root@aclgcl-058 data]# vi /etc/my.cnf
1. The following options will be passed to all MySQL clients
[client] port = 3306 socket = /usr/local/mytools/repository/mysql-5.0.51a/tmp/mysql.sock
1. The MySQL server
[mysqld] port = 3306 socket = /usr/local/mytools/repository/mysql-5.0.51a/tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M sync_binlog = 1 user=mysql
1. binary logging is required for replication
log-bin=/usr/local/mytools/repository/mysql-5.0.51a/data/mysql-bin binlog-do-db = gisus
server-id = 1
1. Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mytools/repository/mysql-5.0.51a/data/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /usr/local/mytools/repository/mysql-5.0.51a/data/ innodb_log_arch_dir = /usr/local/mytools/repository/mysql-5.0.51a/data/
1. You can set .._buffer_pool_size up to 50 - 80 %
2. of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M
1. Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50
[mysqldump] quick max_allowed_packet = 16M
[mysql] no-auto-rehash
1. Remove the next comment character if you are not familiar with SQL
2. safe-updates
[isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[mysqlhotcopy] interactive-timeout
[root@aclgcl-058 etc]# /etc/init.d/mysql start Starting MySQL [ OK ] [root@aclgcl-058 etc]# /usr/local/mytools/repository/mysql-5.0.51a/bin/mysqladmin -u root password '123456'
5) Create the master database.
[root@aclgcl-058 etc]# /usr/local/mytools/repository/mysql-5.0.51a/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.0.51a-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> source /tmp/gisus.sql Query OK, 1 row affected (0.00 sec)
Database changed Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql>grant replication slave on *.* to 'repl'@'172.24.3.244' identified by 'Replicate01ME!'; Query OK, 0 rows affected (0.00 sec)
mysql>grant replication slave on *.* to 'repl'@'172.24.61.134' identified by 'Replicate01ME!'; Query OK, 0 rows affected (0.00 sec)
mysql>grant replication slave on *.* to 'repl'@'172.24.61.17' identified by 'Replicate01ME!'; Query OK, 0 rows affected (0.00 sec)
mysql> show master status; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000003 | 3742 | gisus | | +------------------+----------+--------------+------------------+ 1 row in set (0.00 sec)
mysql> quit Bye [root@aclgcl-058 data]#
6) Create the first slave database
semerci1@aclgcl46-041 ~ >sudo su - [root@aclgcl46-041:~] export PATH=/local/tools/repository/mysql-5.0.51a/bin:$PATH [root@aclgcl46-041:~] mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... 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: /local/tools/repository/mysql-5.0.51a/bin/mysqladmin -u root password 'new-password' /local/tools/repository/mysql-5.0.51a/bin/mysqladmin -u root -h aclgcl46-041 password 'new-password'
Alternatively you can run: /local/tools/repository/mysql-5.0.51a/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 /local/tools/repository/mysql-5.0.51a ; /local/tools/repository/mysql-5.0.51a/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 /local/tools/repository/mysql-5.0.51a/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 [root@aclgcl46-041:~] cd /local/tools/repository/mysql-5.0.51a [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] vi my.cnf [client]
1. password = your_password
port = 3308 socket = /local/tools/repository/mysql-5.0.51a/tmp/mysql.sock
1. The MySQL server
[mysqld] port = 3308 socket = /local/tools/repository/mysql-5.0.51a/tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M
1. but will not function as a master if omitted
server-id = <server id>
1.
2. The replication master for this slave - required
master-host = 172.24.61.58
1.
2. The username the slave will use for authentication when connecting
3. to the master - required
master-user = root
1.
2. The password the slave will authenticate with when connecting to
3. the master - required
master-password = 123456
1.
2. The port the master is listening on.
3. optional - defaults to 3306
master-port = 3306
1.
2. binary logging - not required for slaves, but recommended
log-bin=mysql-bin
replicate-do-db = gisus replicate-ignore-table = gisus.authorization log-slave-updates
1. slave-skip-errors=all
1. Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /local/tools/repository/mysql-5.0.51a/var/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /local/tools/repository/mysql-5.0.51a/var/ innodb_log_arch_dir = /local/tools/repository/mysql-5.0.51a/var/
1. You can set .._buffer_pool_size up to 50 - 80 %
2. of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M
1. Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
1. innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50
[mysqldump] quick max_allowed_packet = 16M
[mysql] no-auto-rehash
1. Remove the next comment character if you are not familiar with SQL
2. safe-updates
[isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[mysqlhotcopy] interactive-timeout
root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] /local/tools/repository/mysql-5.0.51a/bin/mysqld_safe --user=mysql --pid-file=/local/tools/repository/mysql-5.0.51a/var/mysqlmanager-aclgcl46-041.pid --skip-slave-start & [1] 2521 [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] Starting mysqld daemon with databases from /local/tools/repository/mysql-5.0.51a/var [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] mysqladmin -u root password '123456' [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.51a-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> source /tmp/raffi/gisus.sql Query OK, 1 row affected (0.00 sec)
Database changed Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> mysql> change master to
-> master_host='172.24.61.58',
-> master_user='repl',
-> master_password='Replicate01ME!',
-> master_log_file='mysql-bin.000003',
-> master_log_pos=3742;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave; Query OK, 0 rows affected (0.00 sec)
mysql> show slave status \G
·
o
§
§
§
§
§
§
§
·
o
§
§
§
§
§
§
§
·
o
§
§
§
§
§
§
§ 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.24.61.58
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 3742
Relay_Log_File: mysqlmanager-aclgcl46-041-relay-bin.000002
Relay_Log_Pos: 235
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: gisus
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table: gisus.authorization
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 3742
Relay_Log_Space: 235
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)
mysql> quit Bye [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a]
7) Repeat step 6 on each slaves (Not detailled here)
BUT DO NOT FORGET TO MODIFY the server-id of the my.cnf file for each server. Each server should have a different id.
Contents
[hide]
· 1 env
· 2 Open SSL
· 3 stow
· 4 httpd
· 5 zlib
· 6 GNU M4
· 7 Bison
· 8 cmake
· 9 mysql-5.5.x with cmake
· 10 mysql
· 11 libxml
· 12 gd
· 13 imap
· 14 php
· 15 phpMyAdmin
· 16 dotproject
· 17 mysql replication
[edit] env
mkdir -p /local/tools cd /local/tools mkdir repository mkdir sources
[edit] Open SSL
tar -zxf /data/download/openssl-0.9.8i.tar.gz
cd /data/tools/source/openssl-0.9.8i
./config --prefix=/data/tools/repository/openssl
/data/tools/bin/openssl genrsa -des3 -rand /data/download/mysql-5.0.91.tar.gz:/data/download/httpd-2.2.17.tar.gz -out localhost.key 1024
/data/tools/bin/openssl rsa -in localhost.key -out localhost.key.unsecure
/data/tools/bin/openssl req -new -key localhost.key -out localhost.key.csr
/data/tools/bin/openssl x509 -req -days 30 -in localhost.key.csr -signkey localhost.key -out localhost.cert
chmod 400 localhost.cert
chmod 400 localhost.key
chmod 400 localhost.key.unsecure
[edit] stow
cd /data/tools/sources tar -zxf /data/archives/stow-1.3.3.tar.gz cd stow-1.3.3 ./configure --prefix=/data/tools/repository/stow-1.3.3 make make install cd /data/tools/repository/stow-1.3.3 chmod -R 755 . cd .. ./stow-1.3.3/bin/stow stow-1.3.3
[edit] httpd
cd /local/tools/sources
tar -zxf /data/archive/httpd-2.2.4.tar.gz
For bz2 file: tar xvjf /data/archives/httpd-2.2.17.tar.bz2
cd httpd-2.2.0
CFLAGS="-O2" ./configure --prefix=/data/tools/repository/httpd-2.2.17 -enable-rewrite=shared --enable-so --enable-cgi --enable-info --enable-http --enable-proxy --enable-authn-alias --enable-authz-owner --enable-auth-digest --enable-dbd --enable-mime-magic --enable-ident --enable-authn-dbd --enable-ssl --enable-mods-shared=all --with-ssl=/data/tools --with-z=/data/tools --enable-deflate --with-mpm=prefork –with-ldap
make
make install
cd /data/tools/repository/httpd-2.2.17
chmod -R 755 .
chown -R httpd .
chgrp -R httpd .
cd ..
/data/tools/bin/stow httpd-2.2.17
cp /data/tools/bin/apachectl /etc/init.d/httpd
vi /data/tools/repository/httpd-2.2.17/conf/httpd.conf
1. Edit /local/tools/repository/httpd-2.2.17conf/httpd.conf
2. Modify line 66: User httpd
3. Modify line 67: Group httpd
4. Modify line 88: ServerAdmin raffi.semerciyan@tcl.com
5. Modify line 97: ServerName 172.24.46.41:80
6. Modify line 104: DocumentRoot "/local/www"
7. Modify line 131: <Directory "/local/www">
[edit] zlib
cd /data/tools/sources
tar -zxf /data/archives/zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/data/tools/repository/zlib-1.2.3
make
make install
cd /data/tools/repository/zlib-1.2.3
chmod -R 755 .
cd ..
/data/tools/bin/stow zlib-1.2.3
[edit] GNU M4
tar xzvf m4-latest.tar.gz
./configure --prefix=/data/tools/repository/m4-1.4.15
make
make install
cd /data/tools/repository/
/data/tools/bin/stow m4-1.4.15
mv /usr/bin/m4 /usr/bin/m4.backup
cp /data/tools/repository/m4-1.4.15/bin/m4 /usr/bin/m4
[edit] Bison
tar xzvf bison-2.4.3.tar.gz
./configure --prefix=/data/tools/repository/bison-2.4.3
make
make install
cd /data/tools/repository/
/data/tools/bin/stow bison-2.4.3
mv /usr/bin/bison /usr/bin/bison.backup
cp /data/tools/repository/bison-2.4.3/bin/bison /usr/bin/bison
[edit] cmake
tar xzvf cmake-2.8.4.tar.gz
./configure --prefix=/data/tools/repository/cmake-2.8.4
make
make install
cd /data/tools/repository/
/data/tools/bin/stow cmake-2.8.4
[edit] mysql-5.5.x with cmake
tar xzvf mysql-5.5.9.tar.gz
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" /data/tools/bin/cmake -DCMAKE_INSTALL_PREFIX=/data/tools/repository/mysql-5.5.9 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_UNIX_ADDR=/data/tools/repository/mysql-5.5.9/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DWITH_ZLIB=/data/tools -DMYSQL_TCP_PORT=3307
make
make install
cd /data/tools/repository/
/data/tools/bin/stow mysql-5.5.9
/data/tools/repository/mysql-5.5.9/scripts/mysql_install_db --user=mysql --datadir=/home/mysqldb --basedir=/data/tools/repository/mysql-5.5.9
[edit] mysql
cd /data/tools/sources
tar -zxf /data/archives/mysql-5.0.91.tar.gz
cd mysql-5.0.91
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/data/tools/mysql-5.0.91 --localstatedir=/data/mysqldb --with-unix-socket-path=/data/tools/mysql-5.0.91/tmp/mysql.sock --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-tcp-port=3306 --with-big-tables --with-isam --with-mysqld-user=mysql
make
make install
cd /data/tools/repository/mysql-5.0.91
mkdir etc
cp /data/tools/source/mysql-5.0.91/support-files/my-medium.cnf etc/my.cnf
cp /data/tools/sources/mysql-5.0.91/support-files/mysql.server /etc/init.d/mysql-5.0.91.server
vi /etc/init.d/mysql-5.5.9.server
1. <Edit /etc/init.d/mysql-5.0.91.server and change the following lines:
2. 74: PATH=$basedir/bin:/sbin:/usr/sbin:/bin:/usr/bin
3. 135: conf=$basedir/etc/my.cnf
4. >
chmod 777 /etc/init.d/mysql-5.0.91.server
find . -type d -exec chmod o+x {} \;
chmod -R o+r .
mkdir var tmp
chown mysql.mysql var tmp
chmod 777 var tmp
1. If you don't perform the following and if mysql cannot enter the /local/tools
2. directory, then you will encounter the following errors when installing the database.
3. ERROR: 1 Can't create/write to file '/data/tools/repository/mysql-5.0.90/var/mysql/db.MYI' (Errcode: 13)
chmod -R 755 /data/tools
./bin/mysql_install_db --user=mysql
/etc/init.d/mysql-5.5.9.server start
cd /data/tools/repository
/data/tools/bin/stow mysql-5.0.91
/data/tools/bin/mysql -h localhost -u root
1. mysql> DROP DATABASE test;
1. mysql> GRANT USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY 'Admin01ME!';
1. mysql> DELETE FROM mysql.user WHERE User=;
[edit] libxml
cd /local/tools/sources
tar -zxf /data/archives/libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
./configure --prefix=/data/tools/repository/libxml2-2.7.8
/bin/rm: cannot remove `libtoolT': No such file or directory
WTF??? if you have this problem, you can do: cp ./libtool ./libtoolT
./configure --prefix=/data/tools/repository/libxml2-2.7.8
make
make install
cd /data/tools/repository/libxml2-2.7.8
chmod -R 755 .
cd ..
/data/tools/bin/stow libxml2-2.7.8
[edit] gd
cd /data/tools/sources
tar -zxvf /data/archives/gd-2.0.36RC1.tar.gz
cd gd-2.0.33
./configure --prefix=/data/tools/repository/gd-2.0.36RC1
make
make install
cd /data/tools/repository/
../bin/stow gd-2.0.36RC1
[edit] imap
cd /data/tools/sources
tar -zxf /data/archives/imap-2007e.tar.gz
cd imap-2007e/
make lrh
cd /data/tools/lib
ln -s /data/tools/sources/imap-2007e/c-client/c-client.a .
cd /data/tools/include
ln -s /data/tools/sources/imap-2007e/c-client/c-client.h .
ln -s /data/tools/sources/imap-2007e/c-client/mail.h .
ln -s /data/tools/sources/imap-2007e/c-client/imap4r1.h .
ln -s /data/tools/sources/imap-2007e/c-client/osdep.h .
ln -s /data/tools/sources/imap-2007e/c-client/rfc822.h .
ln -s /data/tools/sources/imap-2007e/c-client/smtp.h .
ln -s /data/tools/sources/imap-2007e/c-client/nntp.h .
ln -s /data/tools/sources/imap-2007e/c-client/utf8.h .
ln -s /data/tools/sources/imap-2007e/c-client/utf8aux.h .
ln -s /data/tools/sources/imap-2007e/c-client/misc.h .
ln -s /data/tools/sources/imap-2007e/c-client/linkage.h .
ln -s /data/tools/sources/imap-2007e/c-client/env_unix.h .
ln -s /data/tools/sources/imap-2007e/c-client/fs.h .
ln -s /data/tools/sources/imap-2007e/c-client/nl.h .
ln -s /data/tools/sources/imap-2007e/c-client/tcp.h .
ln -s /data/tools/sources/imap-2007e/c-client/env.h .
ln -s /data/tools/sources/imap-2007e/c-client/ftl.h .
cd ../openldap-2.0.7
./configure --prefix=/data/tools/repository/ldap --enable-dns --enable-cldap --enable-ldapd --enable-wrappers --enable-phonetic --enable-passwd --enable-shell
make depend
make
make test
su root -c \make install\
[edit] php
cd /data/tools/source
tar -jxf /data/archives/php-5.3.3.tar.bz2
cd php-5.3.3
Because we didn't put the binaries at the official place, if you try to configure PHP, it will fails because of MySQL dynamic libraries. So you need to tell to the configuration where to find these MySQL libraries.
For example, if MySQL libraries are found in /data/tools/lib/mysql then you should define the LDFLAGS variable just BEFORE the configure:
export LDFLAGS="-lpthread -Wl,-R, /data/tools/repository/mysql-5.0.33/lib/mysql"
./configure --prefix=/data/tools/repository/php-5.3.3 --disable-debug --enable-session --with-regex=php --enable-debug=no --enable-magic-quotes --enable-mbstring --enable-safe-mode --enable-ctype --with-gettext --without-pear --disable-rpath --enable-wddx=shared --with-ttf --enable-gd-native-ttf --with-config-file-path=/data/tools/repository/php-5.3.3/etc --with-zlib-dir=/data/tools --with-libxml-dir=/data/tools --with-apxs2=/data/tools/repository/httpd-2.2.17/bin/apxs --with-mysql=/data/tools/repository/mysql-5.0.91/ --with-mysql-sock=/data/tools/repository/mysql-5.0.91/tmp/ --enable-cgi --enable-ldap
make
make install
[edit] phpMyAdmin
cd /local/www
tar -jxf /local/archive/phpMyAdmin-2.8.0.2.tar.bz2
cd phpMyAdmin-2.8.0.2
chmod 755 -R .
chown -R httpd .
chgrp -R httpd .
cat >/local/www/phpMyAdmin-2.8.0.2/config.inc.php <<EOF
<?php
/* Servers configuration */
$i = 0;
/* Server localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['socket'] = '/local/tools/tmp/mysql.sock';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'Admin01ME!';
/* End of servers configuration */
?>
EOF
chmod 770 /local/www/phpMyAdmin-2.8.0.2/config.inc.php
chown httpd /local/www/phpMyAdmin-2.8.0.2/config.inc.php
chgrp httpd /local/www/phpMyAdmin-2.8.0.2/config.inc.php
[edit] dotproject
cd /local/www
tar -zxf /local/archive/dotproject-v2.0.2.tar.gz
cd dotproject
chmod 755 -R .
chown -R httpd .
chgrp -R httpd .
[edit] mysql replication
We want to replicate a database named 'gisus' on 172.24.61.58 to a database named 'gisus' on 172.24.61.134, 172.24.3.244 and 172.24.61.17. We suppose we just installed mysql on each server.
1) In order to have no compatibilities problem, we will use the same MySQL version on all servers. 5.0.51a.
2) On the master server (172.24.61.58), we put a copy of the file /vobs/tools_gsus/gisusdb/gisus.sql (Clearcase) into /tmp.
semerci1@aclgcl46-041 ~ >ct setview tools_gsus_v0.1_dev_semerci1 semerci1@aclgcl46-041 VIEW tools_gsus_v0.1_dev_semerci1 ~ >cd /vobs/tools_gsus/gisusdb semerci1@aclgcl46-041 VIEW tools_gsus_v0.1_dev_semerci1 /vobs/tools_gsus/gisusdb >scp gisus.sql root@172.24.61.58:/tmp
3) Log in to the master server (172.24.61.58). In the following example, we suppose that you installed your public authentication key and that you have ssh-agent running on semerci1@aclgcl46-041 (that's why we don't need to type the password. If a password or passphrase is requested, then just type it).
semerci1@aclgcl46-041 ~ >ssh root@172.24.61.58 [root@aclgcl-058 ~]#
4) Initialize a new database, configure mysql and start the server.
[root@aclgcl-058 data]# /usr/local/mytools/repository/mysql-5.0.51a/bin/mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... 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: /usr/local/mytools/repository/mysql-5.0.51a/bin/mysqladmin -u root password 'new-password' /usr/local/mytools/repository/mysql-5.0.51a/bin/mysqladmin -u root -h aclgcl-058 password 'new-password'
Alternatively you can run: /usr/local/mytools/repository/mysql-5.0.51a/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 /usr/local/mytools/repository/mysql-5.0.51a ; /usr/local/mytools/repository/mysql-5.0.51a/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 /usr/local/mytools/repository/mysql-5.0.51a/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 [root@aclgcl-058 data]# vi /etc/my.cnf
1. The following options will be passed to all MySQL clients
[client] port = 3306 socket = /usr/local/mytools/repository/mysql-5.0.51a/tmp/mysql.sock
1. The MySQL server
[mysqld] port = 3306 socket = /usr/local/mytools/repository/mysql-5.0.51a/tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M sync_binlog = 1 user=mysql
1. binary logging is required for replication
log-bin=/usr/local/mytools/repository/mysql-5.0.51a/data/mysql-bin binlog-do-db = gisus
server-id = 1
1. Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mytools/repository/mysql-5.0.51a/data/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /usr/local/mytools/repository/mysql-5.0.51a/data/ innodb_log_arch_dir = /usr/local/mytools/repository/mysql-5.0.51a/data/
1. You can set .._buffer_pool_size up to 50 - 80 %
2. of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M
1. Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50
[mysqldump] quick max_allowed_packet = 16M
[mysql] no-auto-rehash
1. Remove the next comment character if you are not familiar with SQL
2. safe-updates
[isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[mysqlhotcopy] interactive-timeout
[root@aclgcl-058 etc]# /etc/init.d/mysql start Starting MySQL [ OK ] [root@aclgcl-058 etc]# /usr/local/mytools/repository/mysql-5.0.51a/bin/mysqladmin -u root password '123456'
5) Create the master database.
[root@aclgcl-058 etc]# /usr/local/mytools/repository/mysql-5.0.51a/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.0.51a-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> source /tmp/gisus.sql Query OK, 1 row affected (0.00 sec)
Database changed Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql>grant replication slave on *.* to 'repl'@'172.24.3.244' identified by 'Replicate01ME!'; Query OK, 0 rows affected (0.00 sec)
mysql>grant replication slave on *.* to 'repl'@'172.24.61.134' identified by 'Replicate01ME!'; Query OK, 0 rows affected (0.00 sec)
mysql>grant replication slave on *.* to 'repl'@'172.24.61.17' identified by 'Replicate01ME!'; Query OK, 0 rows affected (0.00 sec)
mysql> show master status; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000003 | 3742 | gisus | | +------------------+----------+--------------+------------------+ 1 row in set (0.00 sec)
mysql> quit Bye [root@aclgcl-058 data]#
6) Create the first slave database
semerci1@aclgcl46-041 ~ >sudo su - [root@aclgcl46-041:~] export PATH=/local/tools/repository/mysql-5.0.51a/bin:$PATH [root@aclgcl46-041:~] mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... 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: /local/tools/repository/mysql-5.0.51a/bin/mysqladmin -u root password 'new-password' /local/tools/repository/mysql-5.0.51a/bin/mysqladmin -u root -h aclgcl46-041 password 'new-password'
Alternatively you can run: /local/tools/repository/mysql-5.0.51a/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 /local/tools/repository/mysql-5.0.51a ; /local/tools/repository/mysql-5.0.51a/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 /local/tools/repository/mysql-5.0.51a/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 [root@aclgcl46-041:~] cd /local/tools/repository/mysql-5.0.51a [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] vi my.cnf [client]
1. password = your_password
port = 3308 socket = /local/tools/repository/mysql-5.0.51a/tmp/mysql.sock
1. The MySQL server
[mysqld] port = 3308 socket = /local/tools/repository/mysql-5.0.51a/tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M
1. but will not function as a master if omitted
server-id = <server id>
1.
2. The replication master for this slave - required
master-host = 172.24.61.58
1.
2. The username the slave will use for authentication when connecting
3. to the master - required
master-user = root
1.
2. The password the slave will authenticate with when connecting to
3. the master - required
master-password = 123456
1.
2. The port the master is listening on.
3. optional - defaults to 3306
master-port = 3306
1.
2. binary logging - not required for slaves, but recommended
log-bin=mysql-bin
replicate-do-db = gisus replicate-ignore-table = gisus.authorization log-slave-updates
1. slave-skip-errors=all
1. Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /local/tools/repository/mysql-5.0.51a/var/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /local/tools/repository/mysql-5.0.51a/var/ innodb_log_arch_dir = /local/tools/repository/mysql-5.0.51a/var/
1. You can set .._buffer_pool_size up to 50 - 80 %
2. of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M
1. Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
1. innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50
[mysqldump] quick max_allowed_packet = 16M
[mysql] no-auto-rehash
1. Remove the next comment character if you are not familiar with SQL
2. safe-updates
[isamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[myisamchk] key_buffer = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M
[mysqlhotcopy] interactive-timeout
root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] /local/tools/repository/mysql-5.0.51a/bin/mysqld_safe --user=mysql --pid-file=/local/tools/repository/mysql-5.0.51a/var/mysqlmanager-aclgcl46-041.pid --skip-slave-start & [1] 2521 [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] Starting mysqld daemon with databases from /local/tools/repository/mysql-5.0.51a/var [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] mysqladmin -u root password '123456' [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a] mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.51a-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> source /tmp/raffi/gisus.sql Query OK, 1 row affected (0.00 sec)
Database changed Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> mysql> change master to
-> master_host='172.24.61.58',
-> master_user='repl',
-> master_password='Replicate01ME!',
-> master_log_file='mysql-bin.000003',
-> master_log_pos=3742;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave; Query OK, 0 rows affected (0.00 sec)
mysql> show slave status \G
·
o
§
§
§
§
§
§
§
·
o
§
§
§
§
§
§
§
·
o
§
§
§
§
§
§
§ 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.24.61.58
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 3742
Relay_Log_File: mysqlmanager-aclgcl46-041-relay-bin.000002
Relay_Log_Pos: 235
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: gisus
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table: gisus.authorization
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 3742
Relay_Log_Space: 235
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)
mysql> quit Bye [root@aclgcl46-041:/local/tools/repository/mysql-5.0.51a]
7) Repeat step 6 on each slaves (Not detailled here)
BUT DO NOT FORGET TO MODIFY the server-id of the my.cnf file for each server. Each server should have a different id.
- setup lamp server
- Setup lamp server
- lamp setup (centos)
- The Setup of LAMP
- lamp-server
- Setup an Email server
- MySQL Cluster Server Setup
- Setup a Subversion server
- Setup PXE Server
- ubuntu svn server setup
- setup a subversion server
- MySQL Cluster Server Setup
- ubuntu subversion server setup
- linux zend server setup
- NTP Server Setup
- Linux FTP Server Setup
- setup svn server
- ubuntu svn server setup
- OpenMP的执行模式
- SQL连接,Oracle关联加号(+)等相关知识
- Newtonsoft.Json.4.5.11使用方法总结---反序列化json字符串
- iPhone开发【九】多视图技术总结之二:Tab Bar
- 关于Android中的uses-permission和uses-feature
- Setup lamp server
- Windows8:按钮
- iPhone开发【十】多视图技术总结之三:Navigation
- 实施DHCP服务增加网络引导扩展服务(+PXE启动+网络HTTP安装操作系统)
- IE地址栏中传递中文将会导致乱码. String.IndexOf方法小记
- 收入分配改革应是民富
- Silverlight 创建 PDF iTextSharp
- 如何搭建Repo服务器端
- android fsck_msdos分析