Author:


CentOS下NFS服务器配置

Posted by – 2010-04-20

####################################
#NFS_Configuration
#Author:楚霏
#Date: 2010-4-20
#Update:2010-4-26
#Env: Centos 5.4 x86_64
####################################

二、环境介绍
####################################
两台机器全是Centos 5.4 x86_64
服务端IP=10.0.0.52
客户端IP=10.0.0.166
####################################

三、配置服务端
####################################
#因为默认已经安装portmap,nfs-utils-lib和nfs-utils,所以直接配置即可
#创建要共享的目录

mkdir /nfsdata

#nfs的主配置文件是/etc/exports

vi /etc/exports
#----------------------------引用文字-开始----------------------------
#加入
/nfsdata 10.0.0.0/24(rw,root_squash,no_all_squash,sync)
#----------------------------引用文字-结束----------------------------

#保存设置

exportfs -r

#配置文件每行分为段:
#第一段为共享的目录,使用绝对路径
#第二段为客户端地址及权限:
地址可以使用完整IP或网段,例如10.0.0.8或10.0.0.0/24,10.0.0.0/255.255.255.0当然也可以
地址可以使用主机名,DNS解析的和本地/etc/hosts解析的都行,支持通配符,例如:*.chengyongxu.com
权限有:
rw:read-write,可读写;
ro:read-only,只读;
sync:文件同时写入硬盘和内存;
async:文件暂存于内存,而不是直接写入内存;
no_root_squash:NFS客户端连接服务端时如果使用的是root的话,那么对服务端分享的目录来说,也拥有root权限。显然开启这项是不安全的。
root_squash:NFS客户端连接服务端时如果使用的是root的话,那么对服务端分享的目录来说,拥有匿名用户权限,通常他将使用nobody或nfsnobody身份;
all_squash:不论NFS客户端连接服务端时使用什么用户,对服务端分享的目录来说都是拥有匿名用户权限;
anonuid:匿名用户的UID值,通常是nobody或nfsnobody,可以在此处自行设定;
anongid:匿名用户的GID值。
####################################

四、启动、测试
####################################
#先启动所依赖的postmap

service portmap start
service nfs start

#本地测试

showmount -e 10.0.0.52
#----------------------------输出文字-开始----------------------------
Export list for 10.0.0.52:
/nfsdata 10.0.0.0/24
#----------------------------输出文字-结束----------------------------

#创建挂载点

mkdir /mnt/nfsdata

#挂载

mount -t nfs 10.0.0.52:/nfsdata /root/nfsdata

#检查

mount
#----------------------------输出文字-开始----------------------------
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
10.0.0.52:/nfsdata on /root/nfsdata type nfs (rw,addr=10.0.0.52)
#----------------------------输出文字-结束----------------------------

#写文件进行测试

echo "This is a test" >> /nfsdata/test

#检查一下

cat /root/nfsdata/test

#客户端测试
#步骤相似

service portmap start
service nfs start
showmount -e 10.0.0.52
mount -t nfs 10.0.0.52:/nfsdata /root/nfsdata

#检查

mount
#----------------------------输出文字-开始----------------------------
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
10.0.0.52:/nfsdata on /root/nfsdata type nfs (rw,addr=10.0.0.52)
#----------------------------输出文字-结束----------------------------

#读写一下检查检查

cat /root/nfsdata/test
vi /root/nfsdata/test

#注意:
#如果需要开机挂载的话别忘了在/etc/fstab中加入

#----------------------------引用文字-开始----------------------------
/root/nfsdata	10.0.0.52:/nfsdata
#----------------------------引用文字-结束----------------------------

####################################

五、常见错误
####################################
错误一:Cannot register service: RPC

service nfs restart
#----------------------------输出文字-开始----------------------------
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
                                                           [FAILED]
#----------------------------输出文字-结束----------------------------

#解决方法:
service portmap start
#先启动portmap才行
错误二:Address already in use
tail -f /var/log/message
#----------------------------输出文字-开始----------------------------
Apr 10 13:43:27 bogon nfsd[15918]: nfssvc: Setting version failed: errno 16 (Device or resource busy)
Apr 10 13:43:27 bogon nfsd[15918]: nfssvc: unable to bind UPD socket: errno 98 (Address already in use)
Apr 10 13:45:27 bogon nfsd[15978]: nfssvc: Setting version failed: errno 16 (Device or resource busy)
Apr 10 13:45:27 bogon nfsd[15978]: nfssvc: unable to bind UPD socket: errno 98 (Address already in use)
Apr 10 13:49:05 bogon nfsd[16080]: nfssvc: Setting version failed: errno 16 (Device or resource busy)
#----------------------------输出文字-结束----------------------------

#解决方法:
ps aux | grep nfs
#然后用kill干掉这些进程

错误三:mount: 10.0.0.52:/nfsdata failed, reason given by server: Permission denied

#解决方法:
a.把该客户端的ip加入服务端的/etc/exports
b.服务端的和客户端规则要统一,要么都使用主机名(注意每台机器的hosts文件),要么都使用IP

错误四:客户端挂载超时

tail -f /var/log/message
#----------------------------输出文字-开始----------------------------
Apr 10 14:42:35 localhost kernel: portmap: server localhost not responding, timed out
Apr 10 14:42:35 localhost kernel: RPC: failed to contact portmap (errno -5).
Apr 10 14:42:46 localhost kernel: RPC: failed to contact portmap (errno -512).
Apr 10 14:42:46 localhost kernel: lockd_up: makesock failed, error=-512
Apr 10 14:42:46 localhost kernel: RPC: failed to contact portmap (errno -512).
#----------------------------输出文字-结束----------------------------

#解决方法:
service portmap restart
service nfs restart

错误五:Error: RPC MTAB does not exist.

service nfs start
#----------------------------引用文字-开始----------------------------
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting RPC idmapd: Error: RPC MTAB does not exist.
#----------------------------引用文字-结束----------------------------

#解决方法:
#手动执行
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs/
#需要时加入开机启动时,加入下面两行到/etc/fstab
#----------------------------引用文字-开始----------------------------
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0
nfsd /proc/fs/nfsd nfsd defaults 0 0
#----------------------------引用文字-结束----------------------------

####################################

Nginx+php-fcgi服务器出现kernel: TCP: time wait bucket table overflow解决

Posted by – 2010-04-19

#一台Nginx+php-fcgi的服务器做了负载均衡,在主控端发现一直在报错:

#----------------------------引用文字-开始----------------------------
Apr 19 14:48:38 chengyongxu.com kernel: TCP: time wait bucket table overflow
Apr 19 14:48:44 chengyongxu.com kernel: printk: 137 messages suppressed.
Apr 19 14:48:44 chengyongxu.com kernel: TCP: time wait bucket table overflow
Apr 19 14:48:52 chengyongxu.com kernel: printk: 251 messages suppressed.
Apr 19 14:48:52 chengyongxu.com kernel: TCP: time wait bucket table overflow
Apr 19 14:48:53 chengyongxu.com kernel: printk: 51 messages suppressed.
Apr 19 14:48:53 chengyongxu.com kernel: TCP: time wait bucket table overflow
Apr 19 14:48:59 chengyongxu.com kernel: printk: 119 messages suppressed.
#----------------------------引用文字-结束----------------------------

#再看80端口连接状态

netstat -an | grep 80 | awk '{print $6}' | sort | uniq -c | sort -rn
#----------------------------引用文字-开始----------------------------
   4202 TIME_WAIT
     30 FIN_WAIT1
      9 ESTABLISHED
      5 SYN_RECV
      4 LISTEN
      4 FIN_WAIT2
      4 CLOSING
      2 CONNECTED
      2
#----------------------------引用文字-结束----------------------------

#根据报错提示,需要更改net.ipv4.tcp_max_tw_buckets这个内核参数。这个参数是系统同时保持timewait套接字的最大数量。如果超过这个数字,time-wait套接字将立刻被清除并打印警告信息。这个限制仅仅是为了防止简单的 DoS攻击,你绝对不能过分依靠它或者人为地减小这个值,如果网络实际需要大于缺省值,更应该增加这个值(如果增加了内存之后)。

vi /etc/sysconfig/sysctl.conf
#----------------------------引用文字-开始----------------------------
#找到:
net.ipv4.tcp_max_tw_buckets = 6000
#改为
net.ipv4.tcp_max_tw_buckets = 10000
#----------------------------引用文字-结束----------------------------
#保存并打印设置
sysctl -p

#再看80端口连接状态
netstat -an | grep 80 | awk '{print $6}' | sort | uniq -c | sort -rn
#----------------------------引用文字-开始----------------------------
   5928 TIME_WAIT
     42 FIN_WAIT1
     14 ESTABLISHED
     10 FIN_WAIT2
      6 CLOSING
      4 SYN_RECV
      4 LISTEN
      2 CONNECTED
      2
#----------------------------引用文字-结束----------------------------
netstat -an | grep 80 | awk '{print $6}' | sort | uniq -c | sort -rn
#----------------------------引用文字-开始----------------------------
   5510 TIME_WAIT
     34 FIN_WAIT1
      9 SYN_RECV
      9 ESTABLISHED
      7 FIN_WAIT2
      6 CLOSING
      4 LISTEN
      2 CONNECTED
      2
#----------------------------引用文字-结束----------------------------
netstat -an | grep 80 | awk '{print $6}' | sort | uniq -c | sort -rn
#----------------------------引用文字-开始----------------------------
   5687 TIME_WAIT
     38 FIN_WAIT1
     16 ESTABLISHED
     10 SYN_RECV
      6 FIN_WAIT2
      6 CLOSING
      4 LISTEN
      2 CONNECTED
      2
#----------------------------引用文字-结束----------------------------
netstat -an | grep 80 | awk '{print $6}' | sort | uniq -c | sort -rn
#----------------------------引用文字-开始----------------------------
   5688 TIME_WAIT
     38 FIN_WAIT1
     19 ESTABLISHED
      9 SYN_RECV
      6 FIN_WAIT2
      6 CLOSING
      4 LISTEN
      2 CONNECTED
      2
#----------------------------引用文字-结束----------------------------

#再看/var/log/messages和dmesg的信息,已经不再报错了,看来net.ipv4.tcp_max_tw_buckets=10000暂时是够用了

大量snmpd Received SNMP packet(s) from UDP日志解决

Posted by – 2010-04-19

#装完Cacti和snmp后过一段时间发现/var/log/message里有很多日志:

#—————————-引用文字-开始—————————-
Apr 19 10:53:48 localhost snmpd[4972]: Received SNMP packet(s) from UDP: [192.168.1.123]:1836
Apr 19 10:53:48 localhost snmpd[4972]: Connection from UDP: [192.168.1.123]:31055
Apr 19 10:53:48 localhost snmpd[4972]: Received SNMP packet(s) from UDP: [192.168.1.123]:31055
Apr 19 10:53:48 localhost snmpd[4972]: Connection from UDP: [192.168.1.123]:15546
Apr 19 10:53:48 localhost snmpd[4972]: Received SNMP packet(s) from UDP: [192.168.1.123]:15546
Apr 19 10:53:48 localhost snmpd[4972]: Connection from UDP: [192.168.1.123]:62481
Apr 19 10:53:48 localhost snmpd[4972]: Received SNMP packet(s) from UDP: [192.168.1.123]:62481
#—————————-引用文字-结束—————————-

#无用的志信息太多了,调整一个debug级别就好了:

echo "OPTIONS=\"-LS3d -Lf /dev/null -p /var/run/snmpd.pid\"" >> /etc/sysconfig/snmpd.options
#也可以直接改启动脚本
vi /etc/init.d/snmpd
#—————————-引用文字-开始—————————-
#找到这一项
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
#改为
OPTIONS="-LS3d -Lf /dev/null -p /var/run/snmpd.pid"
#—————————-引用文字-结束—————————-

snmpd日志等级的定义:
0 或 ! —- LOG_EMERG,
1 或 a —- LOG_ALERT,
2 或 c —- LOG_CRIT,
3 或 e —- LOG_ERR,
4 或 w —- LOG_WARNING,
5 或 n —- LOG_NOTICE,
6 或 i —- LOG_INFO, and
7 或 d —- LOG_DEBUG.

#最后别忘了重启服务

service snmpd restart

vi更改无权限的文件

Posted by – 2010-04-16

CentOS下
如果一个普通用户a对一个目录menu有写权限,那么放在这个目录下的其它用户的文件,用户a只需有读权限就可以用vi编辑,并且可以w!强行保存。

龊事一桩

Posted by – 2010-04-15

今天买了一台H3C 5000P的交换机,接上console,先配了一内网ip,测试无误,带的还有web管理界面,爽,把本机ip调的和交换机同一网段,打开,改了密码,直接配置了生产环境中要用的公网ip,关机,去机房上架。。。
把内网网线都从原来交换机上以最快的速度接到了新交换机上,内网正常了,哈哈,再看交换机的公网ip,傻眼了,不通,借机房笔记本,配置和交换机同一网段ip直连,还不通。。
咦?太奇怪了!没划分VLAN?不管了,先出机房再说。
回家之后又问了H3C的技术支持,先确认一下自己组网,是没问题。
在技术支持(PS:一个女工程师,声音和逻辑都不错)的提醒下,原来是WEB界面配置东西也得点界面左下角的保存。
狂汗ing,命令连上去打命令SAVE保存配置,这个知道,但不知道WEB界面也得另行点保存,哎,太龊了。。。
解决起来就简单了,找台不忙的服务器改一下ip,和我用console保存的那个同一网段,telnet上去改之。

#—————————-引用文字-开始—————————-
system-view
[H3C] interface vlan 1
[H3C] ip address ip-address ip-mask
#—————————-引用文字-结束—————————-

#这时会断开连接
#因为改了ip,需要再连上去刚配置的ip,检查一下当前配置,无误,保存退出。

#—————————-引用文字-开始—————————-
display current-configuration
save
#—————————-引用文字-结束—————————-

PV_VG_LV和parted的使用

Posted by – 2010-04-14

Basic Terms
Physical Volume(PV):物理卷,处于LVM最底层,可以是物理的硬盘或分区
Volume Group(VG):卷组,建立在PV之上,可以含有一个或多个PV
Logical Volume(LV):逻辑卷,建立在VG之上,相当于原来分区的概念。不过大小可以动态改变。
Physical Extend(PE):物理区域,PV中可以用于分配的最小存储单元,可以建立PV时指定k,同一个VG中的所有PV的PE应该相同。
Logical Extend(LE):逻辑区域,LV中可以用于分配的最小存储单元。取决于LV所在的PV中的PE大小。
Volumes Group Descriptor Area(VGDA):卷组描述区域,存在每个PV中,用于描述该PV本身、PV所含VG、VG中的LV以及LV中的物理区域份分配等信息。

Five Step Process
Create a partition with the right flag / code
Assign the partition as a Physical Volume
Use one or more PVs as a Volume Group
Use space from a VG as a Logical Volume
Format the LV

With a formatted LV
Mount the LV on a directory
Copy desired files to the directory
Document the result in /etc/fstab

How to create a LVM partition
Open up in fdisk
Change the partition type
Open up in parted
Change the partition

Parted Command
#parted命令没有fdisk常用,parted可以用来调整分区的大小等诸多功能
#可以使用以下命令
#这里的*代表可以打tab键补齐的部分
pv*
lv*
vg*

#—————–Cutting Line Start——————–
[root@RHEL ~]# parted /dev/hdd
GNU Parted 1.8.1
Using /dev/hdd
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) print

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 201MB 201MB primary

(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]?
Start? 202
End? 400
(parted) print

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 201MB 201MB primary
2 202MB 400MB 198MB primary

(parted) set
Partition number? 1
Flag to Invert? boot/hidden/raid/lvm/lba/palo/prep? lvm
New state? [on]/off? on
(parted) print

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 201MB 201MB primary lvm
2 202MB 400MB 198MB primary

(parted) quit
Information: Don’t forget to update /etc/fstab, if necessary.
#——————Cutting Line End———————

anaconda-ks.cfg详解

Posted by – 2010-04-14

这个文件记录的是安装系统时的一些信息:
以我的虚拟机为例:

#—————————-引用文字-开始—————————-
# Kickstart file automatically generated by anaconda.

#我用的是光盘安装
install
cdrom

#安装时选择的语言和键盘布局
lang en_US.UTF-8
keyboard us

#网络配置信息
network --device eth0 --bootproto static --ip 10.0.0.241 --netmask 255.255.255.0 --gateway 10.0.0.1 --nameserver 8.8.8.8

#root密码
rootpw --iscrypted $1$uiEOrtaz$XFiz8psay7UuVm.2Dkt1Z1

#防火墙开启的端口
firewall --enabled --port=22:tcp

#认证加密方法
authconfig --enableshadow --enablemd5

#selinux的配置信息
selinux --enforcing

#时区
timezone --utc Asia/Shanghai

#启动引导分区
bootloader --location=mbr --driveorder=hda

# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work

#磁盘配置信息
#clearpart --linux --drives=hda
#part /boot --fstype ext3 --size=100 --ondisk=hda
#part pv.2 --size=0 --grow --ondisk=hda
#volgroup VolGroup00 --pesize=32768 pv.2
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=384 --grow --maxsize=768

#安装时选择的软件包
%packages
@base
@core
@dialup
@editors
keyutils
trousers
fipscheck
device-mapper-multipath
#—————————-引用文字-结束—————————-

那这个文件有什么用呢?
这个配置文件经修改之后可以用于雷同环境下,使用Kickstart来自动安装大量同样的操作系统,

可以把这个文件经修改之后放入U盘,命名为ks.cfg
在装系统时,出现boot界面时就可以输入:
#ks的路径视你的U盘的为哪个盘而定
linux ks=/dev/sdb:/yourpath/ks.cfg

也可以放入nfs服务器,通过网络安装,出现boot界面时就可以输入:
linux ks=nfs:servername:/yourpath/ks.cfg

CentOS安装erlang

Posted by – 2010-04-06

#用RPM最省事

yum install tk unixODBC
cd /usr/local/src
wget -c http://ftp.sunet.se/pub/lang/erlang/download/otp_src_R12B-5.tar.gz
rpm -ivh erlang-R13B04-52.1.x86_64.rpm
#—————————-引用文字-开始—————————-
[root@chengyongxu.com src]# rpm -ivh erlang-R13B04-52.1.x86_64.rpm
warning: erlang-R13B04-52.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID a0e0aedf
Preparing...                ########################################### [100%]
   1:erlang                 ########################################### [100%]
#—————————-引用文字-结束—————————-

MySQL出现Error: page 1 log sequence number解决

Posted by – 2010-04-03

部分库出现无法查询问题,错误日志如下:

#—————————-引用文字-开始—————————-
100403 14:22:53 [Note] Plugin ‘FEDERATED’ is disabled.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
100403 14:22:53 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files…
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer…
100403 14:22:54 InnoDB: Error: page 7 log sequence number 130 976327799
InnoDB: is in the future! Current system log sequence number 106 43427852.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
100403 14:22:54 InnoDB: Error: page 1 log sequence number 130 959426915
InnoDB: is in the future! Current system log sequence number 106 43427852.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
#—————————-引用文字-结束—————————-

按提示在 my.cnf的[mysqld]下加入

[mysqld]
innodb_force_recovery = 4

就开始修复了。但如果是测试,还是建议重新恢复数据库。这样修复会引发更大的问题。例如:

#—————————-引用文字-开始—————————-
100403 14:26:18 InnoDB: Error: space id and page n:o stored in the page
InnoDB: read in are 0:849909, should be 0:917557!
100403 14:26:18 InnoDB: Error: space id and page n:o stored in the page
InnoDB: read in are 0:849916, should be 0:917564!
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
100403 14:26:18 InnoDB: Error: trying to access tablespace 7681216 page no. 4784235,
InnoDB: but the tablespace does not exist or is just being dropped.
…………
#—————————-引用文字-结束—————————-

MySQL_Innodb新增表出现空间问题解决方法

Posted by – 2010-04-03

恢复一个数据库到另外一台服务器上,恢复回去后mysql服务启动失败。
ERR日志如下:

#—————————-引用文字-开始—————————-
100403 10:59:29 mysqld_safe mysqld from pid file /var/lib/mysql/bubian.gaosuni.com.pid ended
100403 11:10:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100403 11:10:31 [Warning] The syntax ‘–log_slow_queries’ is deprecated and will be removed in MySQL 7.0. Please use ‘–slow_query_log’/'–slow_query_log_file’ instead.
100403 11:10:31 [Warning] The syntax ‘–log_slow_queries’ is deprecated and will be removed in MySQL 7.0. Please use ‘–slow_query_log’/'–slow_query_log_file’ instead.
100403 11:10:31 [Note] Plugin ‘FEDERATED’ is disabled.
InnoDB: Error: data file /var/lib/mysql/ibdata5 is of a different size
InnoDB: 195648 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 128000 pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
100403 11:10:32 [ERROR] Plugin ‘InnoDB’ init function returned error.
100403 11:10:32 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
100403 11:10:32 [ERROR] Unknown/unsupported table type: InnoDB
100403 11:10:32 [ERROR] Aborting

100403 11:10:32 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

100403 11:10:32 mysqld_safe mysqld from pid file /var/lib/mysql/bubian.gaosuni.com.pid ended
#—————————-引用文字-结束—————————-

经查引起该错误的原因ibdata5的size和配置文件中innodb_data_file_path不一致。
解决方法:
把innodb_data_file_path选项更改为提示的大小,计算方法195648×16/1024=3057,这样算出来的值单位是MB

#—————————-引用文字-开始—————————-
innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:2000M;ibdata4:2000M;ibdata5:3057M;ibdata6:2000M:auto
extend
#—————————-引用文字-结束—————————-

试着重新启动mysqld服务,SUCCES。