三个虚拟机 均为rhel-server-6.5
[server1]
nginx、php、Discuz
提供vip访问,保护后端数据库
[server3]存储
mysql、drbd、heartbeat 主机
[server4]存储
mysql、drbd、heartbeat 备机
########################################
[server1]
libiconv-1.13.1.tar.gz
libmcrypt-2.5.8.tar.bz2
mhash-0.9.9.9.tar.gz
mcrypt-2.6.8.tar.gz
php-5.3.6.tar.bz2
yum install net-snmp-devel curl-devel libxml2-devel libpng-devel libjpeg-devel freetype-devel gmp-devel openldap-devel -y
yum install -y pcre-devel openssl-devel zlib-devel
nginx-1.0.2.tar.gz
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module
make && make install
cd /usr/local/nginx/conf
useradd -u 900 -s /sbin/nologin nginx ##创建用户
vim nginx.conf ##编辑配置文件
1 user nginx nginx; ##用户名和用户组
2 worker_processes auto; ##进程自定义
3 worker_cpu_affinity 01 10; ## CPU
4
12 events {
13 use epoll; ##异步
14 worker_connections 4096; ##最大连接
15 }
16
17
18 http {
19 include mime.types;
20 default_type application/octet-stream;
21
22 upstream westos {
23 server 172.25.38.3:80; ##后端服务器
24 server 172.25.38.4:80; ##后端服务器
25 }
48 location / {
49 root html;
50 index index.php index.html index.htm; ##重定向
51 }
52
70 location ~ \.php$ {
71 root html;
72 fastcgi_pass 127.0.0.1:9000;
73 fastcgi_index index.php;
74 fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_sc ript_name; ##此处最好写绝对路径
75 include fastcgi.conf;
76 }
77
121 server {
122 listen 80;
123 server_name www.westos.org;
124 location / {
125 proxy_pass http://westos;
126 }
127 }
128 }
127 }
128 }
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/ ##链接
nginx -t ##
nginx ##启动nginx
cd php-5.6.20
cp php.ini.production /usr/local/lnmp/php/etc/php.ini
cd /usr/local/lnmp/php/etc/
cp php-fpm.conf.default php-fpm.conf
cd fpm/
file php-fpm
file init.d.php-fpm
cp init.dphp-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cd /usr/local/lnmp/php/etc/
vim php-fpm.conf
25 pid = run/php-fpm.pid ##进程pid文件
vim php.ini
925 date.timezone = 'Asia/Shanghai' ##地域
########################################
[server3][server4]
yum install -y gcc gcc-c++ make ncurses-devel bison openssl-devel zlib-devel cmake
mysql-5.5.12.tar.gz
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql -DMYSQL_DATADIR=/usr/local/lnmp/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock -DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DENABLED_LOCAL_INFILE=1
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all -DWITH_BOOST=boost/boost_1_59_0/
make -j2 ##两个进程,加快编译速度
make install
useradd -M -s /sbin/nologin mysql ##创建用户
cd /usr/local/lnmp/mysql/bin
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/lnmp/mysql/bin ##添加路径
source ~/.bash_profile ##使文件生效
cd /usr/local/lnmp/mysql/support-files
cp my-default.cnf /etc/my.cnf
cp /etc/my.cnf /etc/my.cnf.bak
file mysql.server
cp mysql.server /etc/init.d/mysqld
cd /user/local/lnmp/mysql
chown mysql.mysqql . -R
mysqld --initialize --user=mysql --basedir=/usr/local/lnmp/mysql/ --datadir=/usr
/local/lnmp/mysql/data
chown root.root . -R
chown mysql data -R
/etc/init.d/mysqld start
mysql -p
进入mysql
alter user root@localhost identified by 'Westos+007';
yum install gcc flex rpm-build kernel-devel -y
rbd-8.4.0.tar.gz
./configure --enable-spec
./configure --enable-spec --with-km
生成两个文件
drbd.spec
drbd-km.spec
cd rpmbuild/RPMS/x86_64
rpm -ivh * ##至少8个,不能缺少drbd-km
scp * 172.25.38.4:/etc/drbd.d/:
cd /etc/drbd.d
vim example.res
1 resource example {
2 meta-disk internal;
3 device /dev/drbd1;
4 syncer {
5 verify-alg sha1;
6 }
7 on server3.example.com {
8 disk /dev/vdb; ##自己添加的硬盘
9 address 172.25.38.3:7789;
10 }
11 on server4.example.com {
12 disk /dev/vdb;
13 address 172.25.38.4:7789;
14 }
15 }
drbdadm create-md example
mkfs.ext4 /dev/drbd1 ##文件系统
问题:
[root@server4 html]# /etc/init.d/httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for server4.example.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
解决方法:
[server1..4]
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.38.1 server1.example.com
172.25.38.2 server2.example.com
172.25.38.3 server3.example.com
172.25.38.4 server4.example.com
问题:
boost::geometry::cs::cartesian>::m_values[1ul]’ may be used uninitialized in this function
解决方法:给大内存和多CPU
问题:
See
make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2
尚未解决,可能是机器真的忙不过来,给大内存和CPU试一试。