xtrabackup-2.1.2-611下载链接:
wget http://www.percona.com/downloads/XtraBackup/XtraBackup-2.1.2/binary/Linux/x86_64/percona-xtrabackup-2.1.2-611.tar.gz
安装编译所需的依赖包
yum install libaio libaio-devel perl-Time-HiRes curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel perl-ExtUtils-MakeMaker perl-DBD-MySQL.* package -y
tar xvf percona-xtrabackup-2.1.2-611.tar.gz
cd /percona-xtrabackup-2.1.2/bin/
[root@CcTalk-DB bin]# ll
total 112420
-rwxr-xr-x 1 root root 110729 May 18 08:00 innobackupex
lrwxrwxrwx 1 root root 12 Aug 23 13:25 innobackupex-1.5.1 -> innobackupex
-rwxr-xr-x 1 root root 2211237 May 18 08:00 xbcrypt
-rwxr-xr-x 1 root root 2285672 May 18 08:00 xbstream
-rwxr-xr-x 1 root root 13033745 May 18 08:00 xtrabackup
-rwxr-xr-x 1 root root 16333506 May 18 07:26 xtrabackup_55
-rwxr-xr-x 1 root root 80988093 May 18 07:44 xtrabackup_56
[root@CcTalk-DB bin]#
3.将innobackupex、xtrabackup等文件copy到mysql程序目录下/bin、目录
cp * /usr/local/mysql/bin/
4.将mysql安装目录下的文件做软链接到/usr/bin/目录下。这个比变量方便,这样就完成了部署安装!!!
ln -s /usr/local/mysql/bin/* /usr/bin/
5.验证:
执行如下命令按 tab 键能够自动关联补全为安装成功!
[root@slave1 ~]# innobackupex
innobackupex innobackupex-1.5.1
[root@slave1 ~]# xtrabackup
xtrabackup xtrabackup_55 xtrabackup_56
[root@CcTalk-DB bin]# innobackupex --helpOptions:
--apply-log
Prepare a backup in BACKUP-DIR by applying the transaction log file
named "xtrabackup_logfile" located in the same directory. Also,
create new transaction logs. The InnoDB configuration is read from
the file "backup-my.cnf".
--compact
Create a compact backup with all secondary index pages omitted. This
option is passed directly to xtrabackup. See xtrabackup
documentation for details.
--compress
This option instructs xtrabackup to compress backup copies of InnoDB
data files. It is passed directly to the xtrabackup child process.
Try 'xtrabackup --help' for more details.
--compress-threads
This option specifies the number of worker threads that will be used
for parallel compression. It is passed directly to the xtrabackup
child process. Try 'xtrabackup --help' for more details.
--compress-chunk-size
This option specifies the size of the internal working buffer for
each compression thread, measured in bytes. It is passed directly to
the xtrabackup child process. Try 'xtrabackup --help' for more
details.
--copy-back
Copy all the files in a previously made backup from the backup
directory to their original locations.
--databases=LIST
This option specifies the list of databases that innobackupex should
back up. The option accepts a string argument or path to file that
contains the list of databases to back up. The list is of the form
"databasename1[.table_name1] databasename2[.table_name2] . . .". If
this option is not specified, all databases containing MyISAM and
InnoDB tables will be backed up. Please make sure that --databases
contains all of the InnoDB databases and tables, so that all of the
innodb.frm files are also backed up. In case the list is very long,
this can be specified in a file, and the full path of the file can
be specified instead of the list. (See option --tables-file.)
--debug-sleep-before-unlock=SECONDS
This is a debug-only option used by the XtraBackup test suite.
--defaults-file=[MY.CNF]
This option specifies what file to read the default MySQL options
from. The option accepts a string argument. It is also passed
directly to xtrabackup's --defaults-file option. See the xtrabackup
&nb
目标:实现windows和linux混合组成的操作 系统中可以共享文件,并可以通过机器名互相访问
安装文件共享服务
0.更改本机主机名,修改 /etc/hostname文件和/etc/hosts文件中的主机名,替换成新的名字(两个都要改),重启
1.安装
需要的包:samba samba-common python-glade2 system-config-samba
sudo apt-get install samba-config-samba winbind即可安装,其他包括在依赖项中
2.添加共享使用的用户
sudo adduser share
3.启动 system-config-samba,用图形化界面添加共享(先选择共享用户)
sudo system-config-samba
4.配置密码
sudo smbpasswd -a share(假设用户名为share)
5.修改 etc/nsswitch.conf,找到下面这行:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
在后面加上wins,变成:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 wins
(没有这一步,就无法通过机器名访问windows共享,只能通过ip访问)
和上文提到的awk一样,sed也是Unix的文本处理工具。sed是Stream Editor(流式编辑器)的缩写,它能够基于模式匹配过滤(所谓过滤就是在文件中找到符合某些条件的行)修改文本(就是对找到的符合条件的内容进行一些修改操作)。
1、sed命令格式
1.1 sed命令的基本格式
sed命令主要有三种使用形式:
- sed ‘编辑指令’ 文件1 文件2 ……:用于将处理后的结果输出
- sed -n ‘编辑指令’ 文件1 文件2 ……:用于只输出编辑指令影响的行
- sed -i ‘编辑指令’ 文件1 文件2 ……:用于直接在文本文件上修改文本内容(在物理磁盘上修改文件)
编辑指令主要由两部分组成:前面是逗号隔开的两个地址(或者没有逗号,只有一个地址),代表要处理文本的起始位置到结束位置;后面是要进行的操作类型。格式如下:
[起始地址[,结束地址]]操作类型
如果在一条sed命令中要用到多条编辑指令,那么各个编辑指令之间要用;隔开,也可以将多条编辑指令放在多个单引号中,但是这样的话,要在每个单引号的前面加一个-e。下面是一个简单的例子:
$cat sed_test.txt 1 apple a,b,d,f 2 boy alsdjf,apple,kdjf 3 cat 163.2.201.1 4 dog www.google.com 5 eat http://blog.csdn.net/xia7139 $sed -n '2,5p' sed_test.txt 2 boy alsdjf,apple,kdjf 3 cat 163.2.201.1 4 dog www.google.com 5 eat http://blog.csdn.net/xia7139 $sed -n '5p' sed_test.txt 5 eat http://blog.csdn.net/xia7139 $sed -n -e '2p' -e'5p' sed_test.txt 2 boy alsdjf,apple,kdjf 5 eat http://blog.csdn.net/xia71391.3 操作类型
sed常用的操作类型如下:
操作 作用 p 打印文本行(print) n 取下一行(next) d 删除(delete) s 字符串替换(substitude) a 追加新的文本(append) 2、例子
下面的例子都是对文提到的文件sed_test.txt的操作:
使用正则表达式: (1)输出从第一个包含kdjf的行到最后一行($代表最后一行) $sed -n '/kdjf/,$p' sed_test.txt 2 boy alsdjf,appleapple,kdjf 3 cat 163.2.201.1 4 dog www.google.com 5 eat http://blog.csdn.net/xia7139 (2)输出包含单词apple的行 (shell中单词是指一个字符串前后有空格或其它标点符号。正则表达式中用一个<>来界定一个单词,在sed中用该符号要进行转义。) $sed -n '/\<apple\>/p' sed_test.txt 1 apple a,b,d,f 删除指定行(这里没有-i,不对原文件进行操作,只是将处理后的结果输出。): (1)删除第2到4行 $sed '2,4d' sed_test.txt 1 apple a,b,d,f 5 eat http://blog.csdn.net/xia7139 (2)删除包含appleapple的行和最后一行($) $sed '/appleapple/d;$d' sed_test.txt 1 apple a,b,d,f 3 cat 163.2.201.1 4 dog www.google.com (3)删除不包含(!表示反选,选中不符合条件的行)apple的行(这样就只剩下了包含apple的行了) $sed '/apple/!d' sed_test.txt 1 apple a,b,d,f 2 boy alsdjf,appleapple,kdjf 替换指定文本: (1)将1-4行的apple换成AMAZON。s代表替换,g代表如果一行出现两个apple则全部替换。 $sed '1,4s/apple/AMAZON/g' sed_test.txt 1 AMAZON a,b,d,f 2 boy alsdjf,AMAZONAMAZON,kdjf 3 cat 163.2.201.1 4 dog www.google.com 5 eat http://blog.csdn.net/xia7139 (2)注释shell脚本(在行首插入#) $sed '1,3s/^/#/g' sed_test.txt #1 apple a,b,d,f #2 boy alsdjf,appleapple,kdjf #3 cat 163.2.201.1 4 dog www.google.com 5 eat http://blog.csdn.net/xia7139 (3)删除字符串apple(如果不写起始地址和结束地址,则默认为所有行。) $sed 's/apple//g' sed_test.txt 1 a,b,d,f 2 boy alsdjf,,kdjf 3 cat 163.2.201.1 4 dog www.google.com 5 eat http://blog.csdn.net/xia7139以上两篇文章介绍了Unix两个文本处理工具awk和sed,希望对大家有所帮助。