分页: 3/196 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]
Sep 8
官方更新了第三方库的版本之后,编译方法和可能遇到的错误和本文部分内容不一样了,全新安装的朋友请看【CentOS下PhxSQL编译安装第2版】

注:仅测试在CentOS release 6.7 和 CentOS Linux release 7.2.1511下编译通过,本文以用户使用较多的CentOS 6 操作系统为例,centos 7 的差别是不需要升级autoconf、automake、gcc和python的版本,其他操作系统的用户请参考官方提供的中文详细编译手册:https://github.com/tencent-wechat/phxsql/wiki/%E4%B8%AD%E6%96%87%E8%AF%A6%E7%BB%86%E7%BC%96%E8%AF%91%E6%89%8B%E5%86%8C

一、准备工作
1.1:相关项目地址:
https://github.com/tencent-wechat/phxsql
https://github.com/google/glog
https://github.com/google/googlemock
https://github.com/google/leveldb
https://github.com/tencent-wechat/phxpaxos
https://github.com/tencent-wechat/phxrpc
https://github.com/tencent-wechat/libco
https://github.com/google/protobuf

1.2:获取源码:
git clone --recursive https://github.com/tencent-wechat/phxsql.git (--recursive参数可以同时获得所依赖的第三方库colib,glog,leveldb,protobuf源码,和依赖库phxpaxos,phxrpc)

1.3:编译前的准备工作,由于centos自带或者使用yum安装的工具软件版本都比较低,所以要升级相关依赖的库及工具。
1.3.1:
yum install readline readline-devel libstdc++-static glibc-static perl-Module-Install.noarch -y

1.3.2:autoconf
下载地址:http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xzvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local/autoconf-2.69
make && make install

mv /usr/bin/autoconf /usr/bin/bak_autoconf
mv /usr/bin/autoheader /usr/bin/bak_autoheader
mv /usr/bin/autom4te /usr/bin/bak_autom4te
mv /usr/bin/autoreconf /usr/bin/bak_autoreconf
mv /usr/bin/autoscan /usr/bin/bak_autoscan
mv /usr/bin/autoupdate /usr/bin/bak_autoupdate  
ln -sf /usr/local/autoconf-2.69/bin/autoconf /usr/bin/autoconf
ln -sf /usr/local/autoconf-2.69/bin/autoheader /usr/bin/autoheader
ln -sf /usr/local/autoconf-2.69/bin/autom4te /usr/bin/autom4te
ln -sf /usr/local/autoconf-2.69/bin/autoreconf /usr/bin/autoreconf
ln -sf /usr/local/autoconf-2.69/bin/autoscan /usr/bin/autoscan
ln -sf /usr/local/autoconf-2.69/bin/autoupdate /usr/bin/autoupdate


1.3.3:automake
下载地址:http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
tar xzvf automake-1.14.tar.gz
cd automake-1.14
./configure --prefix=/usr/local/automake-1.14
make && make install

ln -sf /usr/local/automake-1.14/bin/aclocal-1.14 /usr/bin/aclocal-1.14
ln -sf /usr/local/automake-1.14/bin/automake-1.14 /usr/bin/automake-1.14
ln -sf /usr/local/automake-1.14/bin/aclocal-1.14 /usr/bin/aclocal-1.14
mkdir /usr/share/automake-1.14
ln -sf /usr/local/automake-1.14/share/automake-1.14/test-driver  /usr/share/automake-1.14/test-driver


1.3.4:cmake
下载地址:https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz
tar xzvf cmake-3.6.1.tar.gz
cd cmake-3.6.1
./configure
make && make install


1.3.5:python
下载地址:https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar xzvf Python-2.7.12.tgz
cd Python-2.7.12
./configure --prefix=/usr/local/python27
make && make install


1.3.6:gcc
下载地址:http://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz
tar xzvf gcc-4.9.4.tar.gz
cd gcc-4.9.4
./contrib/download_prerequisites
cd ..
mkdir gcc-build-4.9.4
cd gcc-build-4.9.4
../gcc-4.9.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4 (-j4参数根据自己的cpu核心数来设置,这样编译的速度会快点,其实加了编译的时间也很长的)
make install
ls /usr/local/bin | grep gcc
update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.9.4 40 (优先使用4.9.4版本的gcc)
使用 gcc --version 就可以看见当前使用的gcc版本是刚才编译的新版本了。
cp gcc-build-4.9.4/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.20 /usr/lib64/
删除原来低版本的软链:rm -rf /usr/lib64/libstdc++.so.6
创建新版本的软链:ln -sf /usr/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6


####################################################################
1.3.7:boost   (此步可忽略)
官网:http://www.boost.org/
下载地址:https://sourceforge.net/projects/boost/files/boost/1.61.0/
tar xzvf boost_1_61_0.tar.gz
cd boost_1_61_0
./bootstrap.sh --prefix=/usr/local/boost
./b2
./b2 install

echo /usr/local/boost/lib >/etc/ld.so.conf.d/boost.conf
ldconfig
####################################################################

二、编译相关依赖
2.1:colib
cd /home/phxsql/third_party/colib
make

2.2:glog
cd /home/phxsql/third_party/glog
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. -DCMAKE_INSTALL_PREFIX=/home/phxsql/third_party/glog && make VERBOSE=1
make
make install

2.3:leveldb
/home/phxsql/third_party/leveldb
make
mkdir lib
cp -ar out-shared lib/
cp -ar out-static lib/

2.4:protobuf
cd /home/phxsql/third_party/protobuf
./autogen.sh
./configure CXXFLAGS=-fPIC --prefix=/home/phxsql/third_party/protobuf
make
make install

2.5:phxrpc
cd /home/phxsql/third_party/phxrpc
mv third_party/protobuf third_party/bak_protobuf
ln -sf /home/phxsql/third_party/protobuf /home/phxsql/third_party/phxrpc/third_party/protobuf
ln -sf /usr/local/boost/include/boost /home/phxsql/third_party/phxrpc/boost
make
make boost  (如果前面boost忽略,此步略过)

2.6:phxpaxos
cd /home/phxsql/third_party/phxpaxos
mv third_party/protobuf third_party/bak_protobuf
mv third_party/leveldb third_party/bak_leveldb
mv third_party/glog third_party/bak_glog
ln -sf /home/phxsql/third_party/protobuf /home/phxsql/third_party/phxpaxos/third_party/protobuf
ln -sf /home/phxsql/third_party/leveldb /home/phxsql/third_party/phxpaxos/third_party/leveldb
ln -sf /home/phxsql/third_party/glog /home/phxsql/third_party/phxpaxos/third_party/glog

./autoinstall.sh
make
make install
cd plugin
make
make install


三、编译安装PHXSQL
cd /home/phxsql
wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.31-77.0/source/tarball/percona-server-5.6.31-77.0.tar.gz
tar xzvf percona-server-5.6.31-77.0.tar.gz
mv percona-server-5.6.31-77.0 percona
sh autoinstall.sh
make
make install

3.1:生成安装包
make package
生成的压缩包名称为:phxsql-0.8.0.tar.gz


四、部署测试
把安装包拷贝到其他测试的机器上,解压,本文目录全部为/home/phxsql
创建mysql用户
useradd -d /home/datacenter -s /sbin/nologin mysql
mkdir /home/phxsql/etc
cd /home/phxsql/tools
把director_operator.py文件第26行中的chown user:mysql 修改为chown mysql:mysql
把binary_installer.py文件第35行中的 cd %s/percona.src; ./scripts/mysql_install_db --defaults-file=%s/etc/my.cnf 修改为:cd %spercona.src; ./scripts/mysql_install_db --defaults-file=%setc/my.cnf

测试部署是用的三台虚拟机:
python install.py -i"192.168.1.186" -p 54321 -g 6000 -y 11111 -P 17000 -a 8001 -f /home/datacenter/
python install.py -i"192.168.1.180" -p 54321 -g 6000 -y 11111 -P 17000 -a 8001 -f /home/datacenter/
/usr/local/python27/bin/python2.7 install.py -i"192.168.1.241" -p 54321 -g 6000 -y 11111 -P 17000 -a 8001 -f /home/datacenter/

在任意一台机器上执行
cd /home/phxsql/sbin/
./phxbinlogsvr_tools_phxrpc -f InitBinlogSvrMaster -h"192.168.1.186,192.168.1.180,192.168.1.241" -p 17000 (集群初始化完成之后就可以使用了。)


./phxbinlogsvr_tools_phxrpc -f GetMemberList -h"192.168.1.186" -p 17000
get master 192.168.1.241 expire time 1473313474
ip 192.168.1.186 port 17000
ip 192.168.1.180 port 17000
ip 192.168.1.241 port 17000

登录数据库:
/home/phxsql/percona.src/bin/mysql -uroot -h"192.168.1.186" -P54321

#获取master信息:
./phxbinlogsvr_tools_phxrpc -f GetMasterInfoFromGlobal -h 192.168.1.186 -p 17000
get master 192.168.1.241 expire time 1473314016

修改管理帐号及密码:
./phxbinlogsvr_tools_phxrpc -f SetMySqlAdminInfo -h 192.168.1.180 -p 17000 -u root -d "" -U zhj -D zhj2016  
get master 192.168.1.241 expire time 1473313844
SetMySqlAdminInfo admin username root -> new admin username zhj

用官方提供的测试工具测试:
cd /home/phxsql/tools/
chmod +x test_phxsql.sh
./test_phxsql.sh 54321 192.168.1.186 192.168.1.180 192.168.1.241
点击在新窗口中浏览此图片

sysbench 简单测试:
点击在新窗口中浏览此图片
Tags: ,
Aug 2
ESXI虚拟机磁盘扩容总体上比较简单,为了数据的安全,动手前做好数据备份,或者克隆虚拟机备份,通过VMware vSphere Client客户端连接ESXI,编辑要扩容磁盘的虚拟机设置,选择磁盘可以直接修改为想要扩容的大小,注意该大小确定之后不能往小的修改,重启虚拟机之后你会发现磁盘的容量并没有发生改变,用fdisk -l查看硬盘的容量确实是已修改后的容量了,要想正常使用新增的容量我们还要做以下几步:

一、关闭要扩容的虚拟机,然后把磁盘添加到其他的虚拟机,或者使用LiveCD引导,我们这里直接把磁盘添加到另一台虚拟机,使用VMware vSphere Client客户端连接ESXI,选择要添加磁盘的那台虚拟机,编辑虚拟机设置-添加-硬盘-使用现有虚拟磁盘-浏览选择我们要扩容的那块磁盘之后确定保存,然后重启这台虚拟机。

二、登录虚拟机操作系统,执行以下操作:

[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd0b1bc7f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1033     8297541   82  Linux swap / Solaris
/dev/sdb2            1034       20887   159477255   83  Linux

这是我们内部的测试机,磁盘空间有限,为了充分的利用磁盘空间,分区比较简单,就一个交换分区和根分区,下面我们使用fdisk删除根分区,并重新建根分区:

[root@localhost ~]# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): d
Partition number (1-4): 2

Command (m for help): p

Disk /dev/sdb: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd0b1bc7f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1033     8297541   82  Linux swap / Solaris

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1034-32635, default 1034):
Using default value 1034
Last cylinder, +cylinders or +size{K,M,G} (1034-32635, default 32635):
Using default value 32635

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

三、格式化磁盘
使用 resize2fs 扩大文件系统大小,磁盘原有的数据不会丢失。
e2fsck -f /dev/sdb2
resize2fs /dev/sdb2

四、关闭该虚拟机,移除这块磁盘,启动那台要扩容的虚拟机,登录系统之后我们发现磁盘已经是扩容后的大小了,最重要的是数据无损。
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       239G  101G  126G  45% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
[root@localhost ~]#

如果像阿里云那样,数据盘在单独的一块磁盘,就更好操作了。
Jul 29
错误发生在内部测试使用的ESXI主机上的虚拟机,因为之前的ESXI主机raid卡和温度传感器报错,机器不能正常启动,所以就把磁盘换到另一台配置一样的机器上,启动之后ubuntu、freebsd、debian8、solaris、centos7虚拟机都连接正常,唯独两台CentOS 6.8系统的虚拟机不能连接,于是使用VMware vSphere Client连接ESXI打开控制台登录系统,执行ifconfig发现只剩下:

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:448 (448.0 b)  TX bytes:448 (448.0 b)


执行 /etc/init.d/network restart

Shutting down loopback insterface:                     [  OK  ]
Bringing up loopback insterface:                          [  OK  ]
Bringing up interface eth0:  Device eth0 does not seem to be present,delaying initialization.  
                                                                      [FAILED]

执行 ifconfig -a 发现没有eth0,却有一个eth1,原来是mac地址变化了,知道是什么问题就好办了,不重启机器你可以把eth1的mac地址记下,cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1 然后把里面的eth0改为eth1,HWADDR改为eth1的mac地址,然后service network restart或ifup eth1 就可以了。

如果你的机器可以重启,可以使用以下方法:
vi /etc/sysconfig/network-scripts/ifcfg-eth0 把里面的HWADDR改为eth1的mac地址之后保存。
vi /etc/udev/rules.d/70-persistent-net.rules 你会发现有两行配置,把eth0的那一行删除,把eth1改为eth0之后保存,类似于下面这样:

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ce:cb:ee", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


使用第二种方法的可以把/etc/sysconfig/network-scripts/ifcfg-eth1删了,或者设置为开机不启动,然后执行init 6 或者reboot重新启动虚拟机,虚拟机重新启动之后网络正常了。
Tags: , ,
Jul 27
一、今天编译安装了MySQL5.6.31,安装启动之后错误日志报以下Warning信息:
160727 12:52:32 mysqld_safe Starting mysqld daemon with databases from /home/mysql/3307/data
2016-07-27 12:52:33 0 [Note] /usr/local/webserver/mysql56/bin/mysqld (mysqld 5.6.31-log) starting as process 26248 ...
2016-07-27 12:52:33 26248 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-27 12:52:33 26248 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-27 12:52:33 26248 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-27 12:52:33 26248 [Note] InnoDB: Memory barrier is not used
2016-07-27 12:52:33 26248 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-27 12:52:33 26248 [Note] InnoDB: Using CPU crc32 instructions
2016-07-27 12:52:33 26248 [Note] InnoDB: Initializing buffer pool, size = 512.0M
2016-07-27 12:52:33 26248 [Note] InnoDB: Completed initialization of buffer pool
2016-07-27 12:52:33 26248 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-27 12:52:33 26248 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-27 12:52:33 26248 [Note] InnoDB: Waiting for purge to start
2016-07-27 12:52:33 26248 [Note] InnoDB: 5.6.31 started; log sequence number 1601096
2016-07-27 12:52:33 26248 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3307
2016-07-27 12:52:33 26248 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2016-07-27 12:52:33 26248 [Note] Server socket created on IP: '0.0.0.0'.
2016-07-27 12:52:33 26248 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode.
2016-07-27 12:52:33 26248 [Warning] 'user' entry '@localhost.localdomain' ignored in --skip-name-resolve mode.
2016-07-27 12:52:33 26248 [Warning] 'proxies_priv' entry '@ [email protected]' ignored in --skip-name-resolve mode.
2016-07-27 12:52:33 26248 [Warning] InnoDB: Cannot open table mysql/slave_master_info from the internal data dictionary of InnoDB though the .frm file for th
e table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.
2016-07-27 12:52:33 26248 [Warning] Info table is not ready to be used. Table 'mysql.slave_master_info' cannot be opened.
2016-07-27 12:52:33 26248 [Warning] InnoDB: Cannot open table mysql/slave_worker_info from the internal data dictionary of InnoDB though the .frm file for th
e table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.
2016-07-27 12:52:33 26248 [Warning] InnoDB: Cannot open table mysql/slave_relay_log_info from the internal data dictionary of InnoDB though the .frm file for
the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.
2016-07-27 12:52:33 26248 [Warning] Info table is not ready to be used. Table 'mysql.slave_relay_log_info' cannot be opened.
2016-07-27 12:52:33 26248 [Note] Event Scheduler: Loaded 0 events
2016-07-27 12:52:33 26248 [Note] /usr/local/webserver/mysql56/bin/mysqld: ready for connections.


BUG产生具体原因不详,官方bugs.mysql.com上有提供修复这5张表的SQL文件,下载链接:http://bugs.mysql.com/file.php?id=19725

下面我们就按照文件的说明操作
  1. drop these tables from mysql:
     innodb_index_stats
     innodb_table_stats
     slave_master_info
     slave_relay_log_info
     slave_worker_info
  
  2. delete all .frm & .ibd of the tables above.
  
  3. run this file to recreate the tables above (source five-tables.sql).
  
  4. restart mysqld.

二、具体操作步骤
2.1、删除这5张表
drop table if exists innodb_index_stats;
drop table if exists innodb_table_stats;
drop table if exists slave_master_info;
drop table if exists slave_relay_log_info;
drop table if exists slave_worker_info;
点击在新窗口中浏览此图片

2.2、删除这5张表对应的.frm和.ibd文件
点击在新窗口中浏览此图片
rm -f /home/mysql/3307/data/mysql/*.ibd

2.3、导入下载的five-tables.sql文件
source /home/sql/five-tables.sql

2.4、导入完成之后,重新启动MYSQL服务

三、检验结果:
点击在新窗口中浏览此图片
已经没有报错信息了。
Jul 26
一、第一步获取安装文件,官网目前搜索也找不到了,这里附件提供之前保存的安装文件

二、使用VMware vSphere Client连接ESXI在配置里启用ssh服务,然后通过ssh客户端工具连接ESXI,安装文件通过sftp上传或者在ESXI上下载都可以,本文文件上传至/tmp目录。

三、安装MegaCli
esxcli software vib install -v /tmp/vmware-esx-MegaCli-8.04.07.vib --no-sig-check

四、MegaCli使用
cd /opt/lsi/MegaCLI/

#查看磁盘状态
./MegaCli -PDList -aAll  |  grep  "Firmware state:"
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up


#查看RAID信息
./MegaCli -LDinfo -Lall -aAll    
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :Virtual Disk 0
RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
Size                : 836.625 GB
Parity Size         : 278.875 GB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 4
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
Is VD Cached: No

五、相关命令
./MegaCli -LDInfo -Lall -aALL 查raid级别
./MegaCli -AdpAllInfo -aALL 查raid卡信息
./MegaCli -PDList -aALL 查看硬盘信息
./MegaCli -AdpBbuCmd -aAll 查看电池信息
./MegaCli -FwTermLog -Dsply -aALL 查看raid卡日志
./MegaCli -adpCount 【显示适配器个数】
./MegaCli -AdpGetTime –aALL 【显示适配器时间】
./MegaCli -AdpAllInfo -aAll    【显示所有适配器信息】
./MegaCli -LDInfo -LALL -aAll    【显示所有逻辑磁盘组信息】
./MegaCli -PDList -aAll    【显示所有的物理信息】
./MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
./MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
./MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
./MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL    【显示BBU设计参数】
./MegaCli -AdpBbuCmd -GetBbuProperties -aALL    【显示当前BBU属性】
./MegaCli -cfgdsply -aALL    【显示Raid卡型号,Raid设置,Disk相关信息】

5.1、磁带状态的变化,从拔盘,到插盘的过程中。
Device        |Normal|Damage|Rebuild|Normal
Virtual Drive    |Optimal|Degraded|Degraded|Optimal
Physical Drive    |Online|Failed –> Unconfigured|Rebuild|Online

5.2、查看磁盘缓存策略
./MegaCli -LDGetProp -Cache -L0 -a0
./MegaCli -LDGetProp -Cache -L1 -a0
./MegaCli -LDGetProp -Cache -LALL -a0
./MegaCli -LDGetProp -Cache -LALL -aALL
./MegaCli -LDGetProp -DskCache -LALL -aALL

5.3、设置磁盘缓存策略
缓存策略解释:
WT    (Write through
WB    (Write back)
NORA  (No read ahead)
RA    (Read ahead)
ADRA  (Adaptive read ahead)
Cached
Direct

例子:
./MegaCli -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
./MegaCli -LDSetProp -Cached|-Direct -L0 -a0
enable / disable disk cache
./MegaCli -LDSetProp -EnDskCache|-DisDskCache -L0 -a0

5.4、创建一个raid5阵列,由物理盘 1,2,3构成,该阵列的热备盘是物理盘4
./MegaCli -CfgLdAdd -r5 [32:1,32:2,32:3] WB Direct -Hsp[32:4] -a0

5.5、创建阵列,不指定热备
./MegaCli -CfgLdAdd -r5 [32:1,32:2,32:3] WB Direct -a0

5.6、删除阵列
./MegaCli -CfgLdDel -L1 -a0

5.7、在线添加磁盘
./MegaCli -LDRecon -Start -r5 -Add -PhysDrv[32:5] -L1 -a0

5.8、阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。
./MegaCli -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
./MegaCli -LDInit -ProgDsply -LALL -aALL

5.9、查看阵列后台初始化进度
./MegaCli -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
./MegaCli -LDBI -ProgDsply -LALL -aALL

5.10、指定第5块盘作为全局热备
./MegaCli -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[32:5] -a0

5.11、指定为某个阵列的专用热备
./MegaCli -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[32:5] -a0

5.12、删除全局热备
./MegaCli -PDHSP -Rmv -PhysDrv[32:5] -a0

5.13、将某块物理盘下线/上线
./MegaCli -PDOffline -PhysDrv [32:5] -a0
./MegaCli -PDOnline -PhysDrv [32:5] -a0

5.14、查看物理磁盘重建进度
./MegaCli -PDRbld -ShowProg -PhysDrv [32:5] -a0
或者以动态可视化文字界面显示
./MegaCli -PDRbld -ProgDsply -PhysDrv [32:5] -a0

5.15、查看Foreign状态的磁盘
./MegaCli -CfgForeign -Scan -a0

5.16、清除Foreign状态
./MegaCli -CfgForeign -Clear -a0

5.17、获取某个盘的详细信息
./MegaCli -pdInfo -PhysDrv[32:1] -a0

5.18、创建raid10
./MegaCli -CfgSpanAdd -r10 -Array0[32:1,32:2] -Array1[32:3,32:4] WB Direct -a0

使用MegaCli在线操作raid还是很方便的,在其他操作系统上也有相应的安装包可以使用,感兴趣的可以自己找台机器试试。

参考文档:
http://de.community.dell.com/techcenter/support-services/w/wiki/909.how-to-install-megacli-on-esxi-5-x
Tags: , ,
分页: 3/196 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]