MooseFS 维护

一、启动MooseFS集群 最安全的启动MooseFS集群(避免任何读或写的错误数据或类似的问题)的方式是按照以下命令步骤: 1.启动mfsmaster进程 2.启动所有的mfschunkserver进程 3.启动mfsmetalogger进程(如果配置了mfsmetalogger) 当所有的chunkservers连接到MooseFS master后,任何数目的客户端可以利用mfsmount去挂接被export的文件系统。(可以通过检查master的日志或是CGI监视器来查看是否所有的chunkserver被连接)。 二、停止MooseFS集群 安全的停止MooseFS集群: 1.在所有的客户端卸载MooseFS 文件系统(用umount命令或者是其它等效的命令) 2.用mfschunkserver –s命令停止chunkserver进程 3.用mfsmetalogger –s命令停止metalogger进程 4.用mfsmaster –s命令停止master进程 三、MooseFS chunkservers的维护 假如每个文件的goal(目标)都不小于2,并且没有under-goal文件(这些可以用mfsgetgoal –r和mfsdirinfo命令来检查),那么一个单一的chunkserver在任何时刻都可能做停止或者是重新启动。以后每当需要做停止或者是重新启动另一个chunkserver的时候,要确定之前的chunkserver被连接,而且要没有under-goal chunks。 四、MooseFS元数据的备份 通常元数据有两部分的数据 1.主要元数据文件metadata.mfs,当mfsmaster运行的时候会被命名为metadata.mfs.back 2.元数据改变日志changelog.*.mfs,存储了过去的N小时的文件改变(N的数值是由BACK_LOGS参数设置的,参数的设置在mfschunkserver.cfg配置文件中)。 主要的元数据文件需要定期备份,备份的频率取决于取决于多少小时changelogs储存。元数据changelogs应该实时的自动复制。自从MooseFS 1.6.5,这两项任务是由mfsmetalogger守护进程做的。 五、MooseFS master的恢复 一旦mfsmaster崩溃(例如因为主机或电源失败),需要最后一个元数据日志changelog并入主要的metadata中。这个操作时通过mfsmetarestore工具做的,最简单的方法是: mfsmetarestore -a 如果master数据被存储在MooseFS编译指定地点外的路径,则要利用-d参数指定使用,如: mfsmetarestore -a -d /storage/mfsmaster 六、从备份恢复MooseFS master 为了从备份中恢复一个master,需要做: 1、安装一个mfsmaster 2、利用同样的配置来配置这台mfsmaster(利用备份来找回mfsmaster.cfg),可见配置文件也是需要备份的。 3、找回metadata.mfs.back文件,可以从备份中找,也可以中metalogger主机中找(如果启动了metalogger服务),然后把metadata.mfs.back放入data目录,一般为${prefix}/var/mfs。 4、从在master宕掉之前的任何运行metalogger服务的服务器上拷贝最后metadata文件,然后放入mfsmaster的数据目录。 5、利用mfsmetarestore命令合并元数据changelogs,可以用自动恢复模式mfsmetarestore –a,也可以利用非自动化恢复模式,语法如下: mfsmetarestore -m metadata.mfs.back -o metadata.mfs changelog_ml.*.mfs 转载自:http://bbs.chinaunix.net/viewthread.php?tid=1643863&extra=&page=1

2010-01-29 · 1 min · 54 words · kevin

用cacti监控memcached状态

cacti 配置步骤略 1,安装python环境 yum install python python-setuptools -y 2,安装python-memcached wget ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.45.tar.gz tar xzvf python-memcached-1.45.tar.gz cd python-memcached-1.45 python setup.py install 3,安装cacti-memcached wget http://content.dealnews.com/dealnews/developers/cacti-memcached-1.0.tar.gz tar zxvf cacti-memcached-1.0.tar.gz cd cacti-memcached 把memcached.py 拷贝到Cacti 的scripts目录下,然后进入Cacti控制界面点击 Import Templates –> Import Template from Local File 在浏览里面选择 cacti_memcached_host_template.xml 这个文件 问题描述,这个官方模板只能监听默认端口号码的memcached wget http://tag1consulting.com/files/cacti-memcached-1.0.2.tar.bz2 使用这个模板可以监听指定端口号码的memcached 4,查看memcached信息 python /scripts/memcached.py -p 11211 5,按照cacti常规添加节点步骤添加节点即可

2010-01-29 · 1 min · 51 words · kevin

upgrade moosefs from 1.5 to 1.6

1. Upgrade and restart mfsmaster. 2. Upgrade and restart chunkservers. 3. Upgrade mfs clients (mfstools before remounting MooseFS with new mfsmount), remount MooseFS trees. * mfsmaster ./configure --prefix=/usr/local/mfs --enable-mfsmaster --with-default-user=dxy --with-default-group=dxy; make; make install cp mfsexports.cfg.dist mfsexports.cfg edit mfsexports.cfg, add allowed ip range start: /usr/local/mfs/sbin/mfsmaster start stop: /usr/local/mfs/sbin/mfsmaster -s * mfschunkserver ./configure --prefix=/usr/local/mfs --enable-mfschunkserver --with-default-user=dxy --with-default-group=dxy; make; make install cp mfsmetalogger.cfg.dist mfsmetalogger.cfg start: /usr/local/mfs/sbin/mfschunkserver start stop: /usr/local/mfs/sbin/mfschunkserver -s * mfsmount ./configure --prefix=/usr/local/mfs --enable-mfsmount --with-default-user=dxy --with-default-group=dxy; make; make install /usr/local/mfs/bin/mfsmount -H 192.168.200.226 /mfs

2010-01-29 · 1 min · 82 words · kevin

linux系统实用命令

1、统计apache占用的系统内存 ps aux | grep apache | awk ‘{sum+=$4};END {print sum}’ 注:$4表示第四域 2、在VIM中的一些技巧 (针对当前屏幕) H——跳到第一行 M——跳到中间一行 L——跳到最后一行 (针对整个文档) gg——到首行 G——到尾行 7yy复制7行 5dd 删除5行 dG 删除所有行 d$ 从当前位置删除到行尾 y$ 从当前位置复制到行尾 3、让命令提示符前显示完整路径 vi /etc/bashrc 找到 “$PS1″ = “\\s-\\v\\\$ ” ] && PS1=”[\u@\h \W]\\$ “这一行,把这里的W改成小w,然后再重新启动一下机器就能实现 4、在字符界面下安装开发工具与开发库 # yum groupinstall “Development Tools” # yum groupinstall “Development Libraries” 转载自:http://www.freeopens.com/2010_01_109.html

2010-01-26 · 1 min · 54 words · kevin

DD命令详解

1.命令简介 dd 的主要选项: 指定数字的地方若以下列字符结尾乘以相应的数字: b=512, c=1, k=1024, w=2, xm=number m if=file #输入文件名,缺省为标准输入。 of=file #输出文件名,缺省为标准输出。 ibs=bytes #一次读入 bytes 个字节(即一个块大小为 bytes 个字节)。 obs=bytes #一次写 bytes 个字节(即一个块大小为 bytes 个字节)。 bs=bytes #同时设置读写块的大小为 bytes ,可代替 ibs 和 obs 。 cbs=bytes #一次转换 bytes 个字节,即转换缓冲区大小。 skip=blocks #从输入文件开头跳过 blocks 个块后再开始复制。 seek=blocks #从输出文件开头跳过 blocks 个块后再开始复制。(通常只有当输出文件是磁盘或磁带时才有效)。 count=blocks #仅拷贝 blocks 个块,块大小等于 ibs 指定的字节数。 conv=conversion[,conversion…] #用指定的参数转换文件。 转换参数: ascii 转换 EBCDIC 为 ASCII。 ebcdic 转换 ASCII 为 EBCDIC。 ibm 转换 ASCII 为 alternate EBCDIC. block 把每一行转换为长度为 cbs 的记录,不足部分用空格填充。 unblock 使每一行的长度都为 cbs ,不足部分用空格填充。 lcase 把大写字符转换为小写字符。 ucase 把小写字符转换为大写字符。 swab 交换输入的每对字节。 noerror 出错时不停止。 notrunc 不截短输出文件。 sync 把每个输入块填充到ibs个字节,不足部分用空(NUL)字符补齐。 ...

2010-01-26 · 2 min · 264 words · kevin

linux启动过程

硬件读取引导扇区 加载LILO或者grub 加载内核 挂装根文件系统 启动/sbin/init ,一切进程的“祖父” 读取/etc/inittab文件 读取rc.sysinit文件 读取/etc/fstab文件 运行rcX.d下的文件(文件都是init.d下的符号链接) 其中有一个xinetd 的超级进程,调用/etc/xinetd.conf 配置文件,从配置文件中知道读/etc/xinetd.d 文件,结束后调用Miggetty 读取/etc/rc.d/rc.local文件

2010-01-26 · 1 min · 15 words · kevin

Oracle数据库常用基本命令

1、得到数据库名和创建日期 SELECT name, created, log_mode, open_mode FROM v$database; 2、ORACLE数据库的计算机的主机名,ORACLE数据库的实例名及ORACLE数据库管理系统的版本信息 SELECT host_name, instance_name, version FROM v$instance; 3、为了知道oracle数据库版本的一些特殊信息 select * from v$version; 4、获取控制文件名字 select * from v$controlfile; 5、得到Oracle数据库的重做日志配置信息 SELECT group#, members, bytes, status, archived FROM v$log; select GROUP#,MEMBER from v$logfile; 6、获取oracle的每个重做日志(成员)文件所存放的具体位置 select * from v$logfile; 7、知道ORACLE数据库的备份和恢复策略和归档文件的具体位置 archive log list 8、知道ORACLE数据库中到底有多少表空间以及每个表空间的状态 select tablespace_name, block_size, status, contents, logging from dba_tablespaces; select tablespace_name, status from dba_tablespaces; 9、知道每个表空间存在哪个磁盘上以及文件的名字等信息 SELECT file_id, file_name, tablespace_name, status, bytes from dba_data_files; ...

2010-01-26 · 2 min · 219 words · kevin

Linux NFS Root and PXE-Boot

Linux kernel hacking and test running on the same machine becomes a major pain. This tutorial explains how to separate the two easily for a quick code-and-test loop. This tutorial explains how to setup a Linux thin client that boots using PXE by pulling a remote Linux kernel image and mounting a remote root file system over NFS. This is only possible if your client machine has a network card that supports this (do you remember seeing some type of option like press N to boot from network just after posting?). I am using Fedora Core 5 as my server, so some of the details may be specific to FC. ...

2010-01-25 · 3 min · 493 words · kevin

PXELINUX

What is PXELINUX? PXELINUX is a SYSLINUX derivative, for booting Linux off a network server, using a network ROM conforming to the Intel PXE (Pre-Execution Environment) specification. PXELINUX is not a program that is intended to be flashed or burned into a PROM on the network card; if you want that, check out Etherboot ( http://www.etherboot.org/). If you want to create PXE-compliant boot PROM for your network card (to use with PXELINUX, for example), check out NetBoot (http://netboot.sourceforge.net/). ...

2010-01-25 · 15 min · 3174 words · kevin

Setting up a PXE-Boot Server

This documents how to setup a PXE boot server for Linux. This assumes that you’re using Redhat/FC as the PXE boot server. The vast majority of the information has been obtained from the following webpages: http://dev.brantleyonline.com/wiki/index.php/General_Network_%28PXE%29_Booting http://dev.brantleyonline.com/wiki/index.php/PXE_Booting_-_Fedora_Core The first thing to note is that you need to setup your own mini-network that is completely disconnected from the network, since part of this process requires setting up a DHCP server which could conflict with the corporate DHCP server if they were both running on the same network simultaneously. So get yourself a switch from IT up front. You do *NOT* need the switch immediately, so just put it aside until I mention it again later on. The next step is to choose a box to be the PXE boot server. This can really be any box at all, as long as you have a NIC in it that works reliably under Linux. For the purposes of this documentation, I’m going to assume that you’ve loaded Fedora Core 4 on this box (do that now, if you’ve not already). Get this box onto the network with DHCP (just like a normal installation). 2) Next you’ll need to install the following packages (which ship with FC4 already, so if you did an ’everything’ OS install, you should have them already. If not, you can install them easily with yum): tftp-server dhcp httpd syslinux ...

2010-01-25 · 6 min · 1090 words · kevin