服务器硬盘迁移步骤:
因为原来服务器硬盘空间不够,准备更换一个全新的大容量硬盘。新硬盘空间320G,下称为硬盘A,旧硬盘空间80G,称为硬盘B。
迁移大概思路为:先将硬盘A装在一台普通机器上安装好系统,搭建好环境,然后将硬盘B数据全部拷贝到硬盘A上,最后将硬盘A接到原来服务器上使用,步骤如下:
迁移大概思路为:先将硬盘A装在一台普通机器上安装好系统,搭建好环境,然后将硬盘B数据全部拷贝到硬盘A上,最后将硬盘A接到原来服务器上使用,步骤如下:
1.在硬盘A上安装Centos 5.4,原来硬盘B上装的是redhat as4.硬盘分区规划为:
[root@tingso ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 29G 665M 27G 3% /
/dev/hda7 194G 7.8G 176G 5% /var
/dev/hda5 4.8G 1.8G 2.8G 39% /opt
/dev/hda2 57G 4.8G 50G 9% /usr
/dev/hda1 1.9G 41M 1.8G 3% /boot
tmpfs 1.8G 0 1.8G 0% /dev/shm
[root@tingso ~]#
2.在硬盘A上安装Apache-->Mysql-->Php-->Zend环境,全部源码编译安装,并且整合tomcat+jdk+mod_jk:
1).安装httpd
shell# cd /opt
shell# wget http://apache.freelamp.com/httpd/httpd-2.2.14.tar.gz
shell# tar zxvf httpd-2.2.14.tar.gz
shell# cd httpd-2.2.14
shell# ./configure --prefix=/usr/local/apache --enable-module=so
shell# make && make install
安装完成后增加两个模块mod_evasive,mod_security,将两个模块文件放在apache/modules下,并且将配置文件加入到httpd.conf中
2).mysql 5.0.27
shell# groupadd mysql
shell# useradd -g mysql -c "MySQL Server" mysql
shell#cd /opt
shell# tar zxvf mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
shell# mv mysql-5.0.27-linux-i686-glibc23 /usr/local/mysql
shell# cd /usr/local/mysql
shell# chown -R mysql .
shell# chgrp -R mysql .
shell# ./script/mysql_install_db --user=mysql
shell# cp ./support-files/my-medium.cnf /etc/my.cnf
shell# chown -R root .
shell# chown -R mysql data
shell# bin/mysqld_safe --user=mysql &
change password:
shell# ./bin/mysqladmin -u root password 'newpassword'
# ./configure \
> --with-apxs2=/usr/local/apache/bin/apxs \
> --disable-debug \
> --enable-mbstring \
> --enable-xml \
> --with-gd \
> --with-gettext \
> --with-mysql=/usr/local/mysql \
> --with-zlib-dir=/usr/llib
shell# make
shell# make install
shell#cp php-dist.ini /usr/local/lib/php.ini
shell#vi /usr/local/lib/php.ini
disable_functions = system,passthru,exec,shell_exec,popen,phpinfo
shell#vi /usr/local/apache/conf/httpd.conf, add:
> --with-apxs2=/usr/local/apache/bin/apxs \
> --disable-debug \
> --enable-mbstring \
> --enable-xml \
> --with-gd \
> --with-gettext \
> --with-mysql=/usr/local/mysql \
> --with-zlib-dir=/usr/llib
shell# make
shell# make install
shell#cp php-dist.ini /usr/local/lib/php.ini
shell#vi /usr/local/lib/php.ini
disable_functions = system,passthru,exec,shell_exec,popen,phpinfo
shell#vi /usr/local/apache/conf/httpd.conf, add:
<Directory "/var/www">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm index.jsp
</IfModule>
DirectoryIndex index.php index.html index.htm index.jsp
</IfModule>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
4).Zend 3.3.9
wget Zend-Optimizer 3.3.9
shell# mv ZendOptimizer-3.3.9-linux-glibc23-i386 /usr/local/Zend
shell# vi /usr/local/lib/php.ini add:
;[Zend];zend-extension_manager.optimizer_ts=/usr/local/Zend/data/5_2_x_comp/ZendOptimizer.so
shell# /usr/local/apache/bin/apachectl -k restart
shell# mv ZendOptimizer-3.3.9-linux-glibc23-i386 /usr/local/Zend
shell# vi /usr/local/lib/php.ini add:
;[Zend];zend-extension_manager.optimizer_ts=/usr/local/Zend/data/5_2_x_comp/ZendOptimizer.so
shell# /usr/local/apache/bin/apachectl -k restart
问题:
1).# /usr/local/apache/bin/apachectl restart
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
解决:chcon -t texrel_shlib_t /usr/local/apache/modules/libphp5.so
安装完所需环境后,根据A硬盘上的php.ini,my.cnf,httpd.conf配置记录与硬盘B对照,增加新的配置内容。
5).整合tomcat+jdk+mod_jk,安装jsp环境
tomcat:
一个和apache一样的免费开源web服务器,与apache一样都可以处理html页面.不同的是,tomcat是一个基于java的web服务器,是一个servlet(jsp)容器,用来调试开发jsp。是apache的一个扩展,可以独立于apache运行。目前版本是6.0.18.
apache 支持php,cgi,perl,如果要使用java,必须转发给tomcat,由tomcat处理。
J2SE:
Java SE Development Kit (JDK),sun 公司针对java开发的产品,包括java开发工具包,包括编译、运行环境等.
J2SE是java标准版本简写。
MOD_JK:
是apache/iis用来连接tomcat的模块,支持负载均衡和集群。
安装步骤:
tomcat->j2se->mod_jk
下载的软件全部放在/opt下,安装后在/usr/local下。
1.下载apache-tomcat 6.0.18
shell# wget
http://www.hightechimpact.com/Apache/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
shell# tar zxvf apache-tomcat-6.0.18.tar.gz
shell# cp -R apache-tomcat-6.0.18/ /usr/local/tomcat
2.下载j2se 5 update 19
增加可执行权限
shell# chmod +x jdk-1_5_0_19-linux-i586.bin
shell# ./jdk-1_5_0_19-linux-i586.bin
将/opt/jdk1.5.0_19移到/usr/local下,改名为jdk
shell# cp -R jdk1.5.0-19/ /usr/local/jdk
3.下载mod_jk
如果apache是2.0则下载:
下载后拷贝到apache模块目录下
shell# cp mod_jk-1.2.28-httpd-2.2.X.so /usr/local/apache/modules
在/usr/local/apache/conf下新增加一个mod_jk.properties 文件
shell# touch /usr/local/apache/conf/mod_jk.properties
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/jdk
ps=/
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.locadbalancer.type=lb
worker.loadbalancer.balanced_workers=worker1
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line-start
worker.inprocess.jvm_lib=$(workers.jave_home)$(ps)jre$(ps)lib$(ps)
i386$(ps)classic$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
编辑/usr/local/apache/conf/httpd.conf,增加以下内容:
LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.X.so
<IfModule mod_jc.c>
JkWorkersFile /usr/local/apache2/conf/mod_jk.peroperties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
</IfModule>
增加环境变量:
shell# vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export TOMCAT_HOME=/usr/local/tomcat
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$JAVE_HOME/bin:$JAVE_HOME/jre/bin
export CLASSPATH=.:/usr/local/jdk/lib:/usr/local/jdk/jre/lib:$CLASSPATH
使环境变量立即生效:
shell# source /etc/profile
验证环境变量:
shell# echo $JAVE_HOME
/usr/local/jdk
shell# echo $TOMCAT_HOME
/usr/local/tomcat
shell# echo $CATALINA_HOME
/usr/local/tomcat
测试成功否:
shell# java -version
gcj(GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
jave version “1.4.2″ 本来是1.5,居然出现这个。。。
解决的办法:
删除 /usr/bin/java,该文件原本链接到/etc/alternatives/java,重新设置连接:
shell# ln -s /usr/local/jdk/bin/java /usr/bin/java
shell# java -version
java version “1.5.0_19″
Jave(TM) 3 Runtime Environment, Standard Edition (build 1.5.0_19-b02)
Jave HotSpot(TM) Client VM (build 1.5.0_19-b02,mixed mode)
启动tomcat
在/usr/local/tomcat/bin/下执行:
shell# ./catalina.sh run
停止tomcat,可在/usr/local/tomcat/bin下执行:
shell# ./catalina.sh stop
默认端口是8080
http://localhost:8080 即可看到tomcat页面
默认主页存放在$CATALINA_HOME/webapps/ROOT下,可以新建一个.jsp文件测试是否成功:
shell# vi $CATALINA_HOME/webapps/ROOT/test.jsp
<
%@page contentType=”text/html”%>
<
%@page pageEncoding=”UTF-8″%>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>JSP Test Page</title>
</head>
<body>
<h1>This is a JSP Test Page!</h1>
<%= new java.util.Date() %>
</body>
</html>
整合apache
1). vi /usr/local/apache/conf 添加以下内容:
#网站安装目录在/var/www/testsite
<Directory /var/www/testsite/ROOT>
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/testsite/ROOT/WEB-INF>
AllowOverride None
Deny from All
</Directory>
<VirtualHost *:80>
ServerName test.testsite.com
DocumentRoot /var/www/testsite/ROOT
JkMount /*.jsp worker1
JkMount /*.do worker1
JkMount /servlet/* worker1
Jkmount /*.jhtml worker1
JkMount /dwr/* worker1
</VirtualHost>
DirectoryIndex index.jsp
2).# vi /usr/local/tomcat/conf/server.xml 大概在128行,将语句改为:
<Host name=”localhost” appBase=”/var/www/buynew”>
<Context path=”" docBase=”ROOT” />
</Host>
检查其他地方,是否为以下设置:
大约67行:
<Connector port=”8080″ protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″
URIEncoding=”UTF-8″
useBodyEncodingForURI=”ture” />
大概90行开始:
<!– Define an AJP 1.3 Connector on port 8009 –>
<Connector port=”8009″ protocol=”AJP/1.3″ redirectPort=”8443″ URIEncoding=”UTF-8″ />
大概102行:
<Engine name=”Catalina” defaultHost=”localhost”>
#tomcat的配置文件放在/usr/local/tomcat/conf下,一般要修改的文件时:server.xml,tomcat-users.xml
关于mysql数据库配置文件放在/usr/local/tomcat/webapps/ROOT/ROOT/WEB-INF/classes/applicationContext-hibernate.xml,hibernate.cfg.xml下
关于mysql数据库配置文件放在/usr/local/tomcat/webapps/ROOT/ROOT/WEB-INF/classes/applicationContext-hibernate.xml,hibernate.cfg.xml下
3).测试:在IE里输入 http://website/testsite/index.do 可以打开即可。
至此,运行调试jsp的平台以及整合apache已经搭建完成,如果有特别的一些需求,例如优化等,还可以修改相关文件。
安装时的问题:
1.执行jdk-1_5_0_19-linux-i586.bin 后啥反应也没有,看日志有错误:
May 20 17:11:47 localhost kernel: audit(1242810707.294:0): avc: ?denied { read write } for
pid=26816 exe=/bin/bash name=0 dev=devpts ino=2 scontext=root:system_r:httpd_sys_script_t
tcontext=root:object_r:devpts_t tclass=chr_file
May 20 17:11:47 localhost kernel: audit(1242810707.294:0): avc: denied { read write } for
pid=26816 exe=/bin/bash path=/dev/pts/0 dev=devpts ino=2
scontext=root:system_r:httpd_sys_script_t tcontext=root:object_r:devpts_t tclass=chr_file
解决:原来是selinux设置问题,用sestatus查看selinux模式是enforcing,执行setenforce
Permissive后正常
2../jdk-1_5_0_19-linux-i586.bin: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
解决办法: 在下面包里有 libstdc++.so.5 然后复制到/usr/lib里
3.整合apache出错,编辑/usr/local/apache/conf/mod_jk.properties,将以下带来注释:
#workers.tomcat_home=/usr/local/tomcat
#workers.java_home=/usr/local/jdk
#ps=/
#worker.worker1.lbfactor=1
#worker.locadbalancer.type=lb
#worker.loadbalancer.balanced_workers=worker1
#worker.inprocess.type=jni
#worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
#worker.inprocess.cmd_line-start
#worker.inprocess.jvm_lib=$(workers.jave_home)$(ps)jre$(ps)lib$(ps)
#i386$(ps)classic$(ps)libjvm.so
#worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
#worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
4.启动和停止tomcat
usr/local/tomcat/bin/startup.sh
或者:/usr/local/tomcat/bin/catalina.sh run
或者:/usr/local/tomcat/bin/sh startup.sh
停止:
/usr/local/tomcat/bin/sh shutdown.sh
5.运行过程中发现经常网站会打不开,提示错误,每次重启apache,tomcat服务后又暂时可以,过不了多久有出问题
解决:更catalina.sh 里的内存设置,默认最大内存是64,现在改为512.
vi /usr/local/tomcat/bin/catalina.sh
将184行:
JAVA_OPTS=”$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager”
改为: JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote -Xms128m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager”
然后保存重启tomcat即可。
然后保存重启tomcat即可。
3. 配置防火墙,SSH,vsftp
1). 配置防火墙,只开启90,20,21,22,53,67,443,20000端口,脚本配置如下:
#!/bin/sh
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -P INPUT DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp -m multiport --dports 443,80,20,21,22,53 -j ACC
EPT
iptables -A INPUT -i eth0 -p udp -m multiport --dports 67,53 -j ACCEPT
iptables -A INPUT -i eth0 -p icmp -m icmp --icmp-type echo-request -j ACCEPT
#!/bin/sh
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -P INPUT DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp -m multiport --dports 443,80,20,21,22,53 -j ACC
EPT
iptables -A INPUT -i eth0 -p udp -m multiport --dports 67,53 -j ACCEPT
iptables -A INPUT -i eth0 -p icmp -m icmp --icmp-type echo-request -j ACCEPT
2). 安装vsftp-2.2.2
wget vsftpd2.2
shell# tar zxvf vsftpd2.2.tar.gz
shell# cd vsftpd2.2
shell# make
shell# fing nobody 如果没有该用户则新建一个
shell# mkdir /usr/share/empty/ mkdir /var/ftp
shell# useradd -d /var/ftp ftp
shell# chown root.root /var/ftp
shell# chmod og-w /var/ftp
shell# vi /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=000
chroot_local_user=YES
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_list
listen=YES
shell# vi /etc/vsftpd.user_list 增加许可登陆FTP的用户名
wget vsftpd2.2
shell# tar zxvf vsftpd2.2.tar.gz
shell# cd vsftpd2.2
shell# make
shell# fing nobody 如果没有该用户则新建一个
shell# mkdir /usr/share/empty/ mkdir /var/ftp
shell# useradd -d /var/ftp ftp
shell# chown root.root /var/ftp
shell# chmod og-w /var/ftp
shell# vi /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=000
chroot_local_user=YES
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_list
listen=YES
shell# vi /etc/vsftpd.user_list 增加许可登陆FTP的用户名
3). 将硬盘A上有些需要使用的用户迁移过去
先在硬盘B上建立用户名,然后将硬盘A/etc/shadow上的加密密码字符复制黏贴到硬盘B /etc/shadow对应的用户名里即可。
问题:
1). 500 OOPS: could not bind list IPv4 socket
解决:
使用standalone独立模式
chkconfig --list vsftpd
vsftpd on
chkconfig vsftpd --level 3 off
chkconfig vsftpd --level 5 off
vi /etc/xinetd.d/vsftpd
change disable=no to disable=yes
/usr/local/sbin/vsftpd &
vsftpd on
chkconfig vsftpd --level 3 off
chkconfig vsftpd --level 5 off
vi /etc/xinetd.d/vsftpd
change disable=no to disable=yes
/usr/local/sbin/vsftpd &
2). 500 OOPS: cannot read config file: stop
another app is currently holding the yum lock.
解决:
rm -f /var/rum/yum.pid
4).配置ssh,只允许用key+密码方式登录
大致步骤:在服务器端生成一对密钥,然后公钥保存在服务器用户目录.ssh下的authorized_keys2,是个隐藏的目录。私钥必须将id_dsa下载到客户端,然后通过puttygen.exe生成.ppk文件。当用户登录时,服务器会根据公钥来比较私钥,如果相符就允许登陆,否则拒绝。私钥只保存在客户端中,及时有人知道root密码,没有私钥也不能远程登录到服务器上。
1. Server:
1).shell# vi /etc/ssh/sshd_config 修改以下配置:
Port 20000
Protocol 2
PasswordAuthentication no
Port 20000
Protocol 2
PasswordAuthentication no
#为了安全起见,ssh key方式用普通用户登录,例如smallfish
[smallfish@domain ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/smallfish/.ssh/id_dsa):
Created directory '/home/smallfish/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/smallfish/.ssh/id_dsa.
Your public key has been saved in /home/smallfish/.ssh/id_dsa.pub.
The key fingerprint is:
68:e2:be:31:5a:d0:3c:0f:6d:48:31:69:13:9c:58:f3 smallfish@domain.com
[smallfish@domain ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/smallfish/.ssh/id_dsa):
Created directory '/home/smallfish/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/smallfish/.ssh/id_dsa.
Your public key has been saved in /home/smallfish/.ssh/id_dsa.pub.
The key fingerprint is:
68:e2:be:31:5a:d0:3c:0f:6d:48:31:69:13:9c:58:f3 smallfish@domain.com
3).shell$ chmmod o+x /home/smallfish
[smallfish@domain .ssh]$ ls
id_dsa id_dsa.pub
[smallfish@domain .ssh]$ ls
id_dsa id_dsa.pub
4).mv id_dsa.pub authorized_keys2
5).download id_dsa to windows #一般为了方便下载到putty目录下,用于生成ppk文件
6).shell# service sshd restart
5).download id_dsa to windows #一般为了方便下载到putty目录下,用于生成ppk文件
6).shell# service sshd restart
2. Client:
#生成ppk文件
1).open puttygen.exe--Conversions--import key--id_dsa--Enter passpharase for key--Save private key--保存为*.ppk(例如server.ppk)
1).open puttygen.exe--Conversions--import key--id_dsa--Enter passpharase for key--Save private key--保存为*.ppk(例如server.ppk)
#启动客户端测试
2).open putty.exe--Category-SSH-Auth-Private key file for authentication #导入ppk文件
#输入之前在server上设定的passphrase登录
3).login as: smallfish
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
2).open putty.exe--Category-SSH-Auth-Private key file for authentication #导入ppk文件
#输入之前在server上设定的passphrase登录
3).login as: smallfish
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
Ok, 配置完成。
问题:
1.客户端用key登陆的时候提示:
Disconnected: No supported authentication methods available
解决:是由于在客户端puttygen生成ppk文件的时候重新用了Generate命令,直接导入id_dsa文件然后save private key即可。
4.网站和数据库迁移
1).由于所有网站数据都在/var/www下,只要把硬盘A/var/www下所有网站目录数据全部拷贝过去即可,特别要注意的是每个文件和目录的权限、所有者一定要相同。
2). 将A盘/usr/local/mysql/data下所有数据拷贝到B盘同样目录下,设置好目录权限和所有者
5.其他设置
参考A盘的相关文件,修改以下文件:
shell# vi /etc/rc.local
将tomcat,apache,mysql,vsftpd增加到rc.local中,开机后即可启动
shell# vi /etc/crontab
增加常用的配置文件
shell# vi /etc/sysconfig/networks-scripts/ifcfg-eth0 修改网卡IP
shell# vi /etc/recolve.con
shell# vi /etc/hosts
shell# vi /etc/sysconfig/network
shell# ntsysv
查看启动服务,禁用没有用的服务
将tomcat,apache,mysql,vsftpd增加到rc.local中,开机后即可启动
shell# vi /etc/crontab
增加常用的配置文件
shell# vi /etc/sysconfig/networks-scripts/ifcfg-eth0 修改网卡IP
shell# vi /etc/recolve.con
shell# vi /etc/hosts
shell# vi /etc/sysconfig/network
shell# ntsysv
查看启动服务,禁用没有用的服务
6.最后准备工作
在硬盘A上测试访问WEB站点以及防火墙,SSH无误后,对比其他配置文件,然后就可以准备将新硬盘换上去了。
开机测试后没问题,一切正常,至此服务器硬盘迁移工作完成!
碰到的问题:
1).打开SuperSite 提示:
SupeSite info: Can not connect to MySQL server
SupeSite info: Can not connect to MySQL server
User: guest
Time: 2010-3-15 10:42am
Script: /index.php
Time: 2010-3-15 10:42am
Script: /index.php
Error: Access denied for user
'daemon'@'localhost' (using password: NO)
Errno.: 1045
Errno.: 1045
解决:查找旧硬盘site目录下所有者是daemon的文件,和新硬盘比对,不对的地方改回来,其他目录也一样
find /var/www/site -user damon
是因为SupeSite 目录下的部分目录用户所有者权限不同造成的,例如tpl,将原来所属root改成daemon即可。
总结:
对于数据迁移最重要的是在迁移过程中对文件配置,权限检查清楚,在没有切换到新设备的时候要调试完整,而且在前期准备和后期实施过程中必须都有详细记录,出现问题的时候多回想,多看日记。
转载于:https://blog.51cto.com/smallfish01/284223