10.32 rsync 通过服务同步 上

rsyncd.conf 样例
port=873
log file=/var/log/rsync.log
pid file=/var/run/rsync.pid
address=192.168.104.160
[test]
path=/tmp/rsync
use chroot=true
max connections=4
read only=no
list=true
uid=root
gid=root
#auth users=test
#sectets file=/etc/rsyncd.passwd
hosts allow=192.168.104.165

    [root@aming-01 ~]# vi /etc/rsyncd.conf [root@aming-01 ~]# rsync --daemon[root@aming-01 ~]# ps aux|grep rsyncroot       1380  0.0  0.0 114652   524 ?        Ss   05:37   0:00 rsync --daemonroot       1382  0.0  0.0 112676   984 pts/0    S+   05:37   0:00 grep --color=auto rsync[root@aming-01 ~]# mkdir /tmp/rsync[root@aming-01 ~]# chmod 777 /tmp/rsync[root@aming-02 ~]# rsync -avP /tmp/aming.txt 192.168.104.160::test/aming-02.txtrsync: failed to connect to 192.168.104.160 (192.168.104.160): No route to host (113)rsync error: error in socket IO (code 10) at clientserver.c(122) [sender=3.0.9][root@aming-02 ~]# systemctl stop firewalld.service[root@aming-01 ~]# systemctl stop firewalld.service[root@aming-02 ~]# telnet 192.168.104.160 873Trying 192.168.104.160...Connected to 192.168.104.160.Escape character is '^]'.@RSYNCD: 30.0[root@aming-02 ~]# rsync -avP /tmp/aming.txt 192.168.104.160::test/aming-02.txtsending incremental file listaming.txt1054 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/1)sent 1127 bytes  received 27 bytes  2308.00 bytes/sectotal size is 1054  speedup is 0.91rsyncd.conf 配置文件详解port: 指定在哪个端口启动rsyncd服务,默认是873端口。log file: 指定日志文件pid file: 指定pid文件,这个文件的作用设计服务的启动、停止等进程管理操作。address: 指定启动rsyncd服务的IP。假如你的机器有多个IP,就可以指定由其中一个启动rsyncd服务,如果不指定该参数,默认是在全部IP上启动。[] :指定模块名,里面内容自定义。path: 指定数据存放的路径。use chroot true|false : 表示在传输文件前首先chroot到path参数所指定的目录下。这样做的原因是实现额外的安全防护,但缺点是需要以roots权限,并且不能备份指向外部的符号连接所指向的目录文件。默认情况下chroot值未true,如果你的数据当中有软链接文件,阿铭建议你设置成false。[root@aming-01 ~]# killall rsync[root@aming-01 ~]# ps aux|grep rsyncps aux|grep rsyncroot       2533  0.0  0.0 112676   984 pts/0    S+   07:11   0:00 grep --color=auto rsync[root@aming-01 ~]# rsync --daemon[root@aming-01 ~]# ps aux|grep rsyncroot       2535  0.0  0.0 114652   524 ?        Ss   07:11   0:00 rsync --daemonroot       2537  0.0  0.0 112676   984 pts/0    R+   07:11   0:00 grep --color=auto rsync[root@aming-02 ~]# rsync -avLP --port 8730 192.168.104.160::test/ /tmp/test/receiving incremental file listcreated directory /tmp/test./aming-02.txt1054 100%    1.01MB/s    0:00:00 (xfer#1, to-check=0/2)sent 48 bytes  received 1178 bytes  817.33 bytes/sectotal size is 1054  speedup is 0.86

10.33 rsync 通过服务同步 下

max connections:指定最大的连接数,默认是0,即没有限制。
read only ture|false:如果为true,则不能上传到该模块指定的路径下。
list: 表示当用户查询该服务器上的可用模块时,该模块是否被列出,设定为true则列出,false则隐藏。
uid/gid:指定传输文件时以哪个用户/组的身份传输。
auth users:指定传输时要使用的用户名。
secrets file:指定密码文件,该参数连同上面的参数如果不指定,则不适用密码验证。注意改密码文件的权限一定要是600。格式:用户名:密码
hosts allow:表示被允许连接该模块的主机,可以是IP或者网段,如果是多个,中间用空格隔开。
当设置了auth users和secrets file 后,客户端连服务器也需要用用户名密码了,若想在命令行中带上密码,可以设定一个密码文件
rsync -avL test@192.168.104.160::test/test1/ /tmp/test8/ --passwd-file=/etc/pass
其中 /etc/pass 内容就是一个密码,权限要改为600list=true[root@aming-02 ~]# rsync --port=8730 192.168.104.160::test [root@aming-01 ~]# vi /etc/rsyncd.confauth users=testsectets file=/etc/rsyncd.passwd    //去掉注释[root@aming-01 ~]# vi /etc/rsyncd.passwdtest:aming   //添加[root@aming-01 ~]# chmod 600 /etc/rsyncd.passwd[root@aming-02 ~]# vi /etc/rsync_pass.txtaming   //只写密码[root@aming-02 ~]# chmod 600 /etc/rsync_pass.txt#####

10.34 Linux系统日志

/var/log/messages
/etc/logrotate.conf     日志切割配置文件
参考 https://my.oschina.net/u/2000675/blog/908189dmesg 命令 (硬件问题基本都是在这里查看报错信息)
/var/log/dmesg  日志
last 命令,调用的文件是 /var/log/wtmp
lastb 命令查看登陆失败的用户,对应的文件是  /var/log/btmp
/var/log/secure[root@aming-01 ~]# cat /etc/logrotate.conf # see "man logrotate" for details# rotate log files weeklyweekly# keep 4 weeks worth of backlogsrotate 4# create new (empty) log files after rotating old onescreate# use date as a suffix of the rotated filedateext# uncomment this if you want your log files compressed#compress# RPM packages drop log rotation information into this directoryinclude /etc/logrotate.d# no packages own wtmp and btmp -- we'll rotate them here/var/log/wtmp {monthlycreate 0664 root utmpminsize 1Mrotate 1}/var/log/btmp {missingokmonthlycreate 0600 root utmprotate 1}# system-specific logs may be also be configured here.[root@aming-01 ~]# cat /etc/logrotate.d/syslog /var/log/cron/var/log/maillog/var/log/messages/var/log/secure/var/log/spooler{missingoksharedscriptspostrotate/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || trueendscript}[root@aming-01 ~]# lastroot     pts/0        192.168.104.1    Sun Mar 11 22:15   still logged in   reboot   system boot  3.10.0-693.17.1. Sun Mar 11 22:14 - 04:25  (06:10)    root     pts/0        192.168.104.1    Sun Mar 11 05:17 - down   (02:11)    reboot   system boot  3.10.0-693.17.1. Sun Mar 11 05:15 - 07:29  (02:13)    root     pts/0        192.168.104.1    Sat Mar 10 03:42 - down   (03:29)    reboot   system boot  3.10.0-693.17.1. Sat Mar 10 03:35 - 07:12  (03:37)

10.35 screen 工具

为了不让一个任务中断
nohup command &
screen 是一个虚拟终端
yum install -y screen
screen 直接回车就进入了虚拟终端
ctrl+a 组合键再按d退出虚拟终端,但不是结束
screen -ls  查看虚拟终端列表
screen -r id 进入指定的终端
screen -S aming
screen -r aming

转载于:https://blog.51cto.com/9298822/2092214

2018-03-28 Linux学习相关推荐

  1. Vue 第一天学习 ---2018.06.28

    Vue  第一天学习 ---2018.06.28 1.引包 2.学会控制元素.显示数据,基本框架建立 <title>Document</title> <script sr ...

  2. falkon在哪个Linux目录,KaOS 2018.03切换到Falkon浏览器,使用KDE Plasma 5.12 LTS

    KaOS Linux操作系统的开发人员今天宣布,2018年3月的ISO快照可以使用了,采用最新的组件和最新的GNU/Linux技术. KaOS 2018.03现在可供下载,它是第一个使用最近发布的KD ...

  3. Linux学习笔记---命令篇

    Linux学习笔记-命令篇 本笔记是根据尚硅谷的Linux视频,经过自己的总结得出来的笔记,分为两个大章节,一-四章讲的是Linux的文件目录结构.vim编辑器.网络配置和系统管理.进程和服务.第二个 ...

  4. Linux学习-67-日志服务器设置和日志分析工具(logwatch)安装及使用

    15.5 日志服务器设置过程 使用"@IP:端口"或"@@IP:端口"的格式可以把日志发送到远程主机上.可以解决:管理几十台服务器,每天的重要工作就是查看这些服 ...

  5. Linux 学习--一篇就学懂Linux(万字长文)

    Linux 学习笔记 Linux 学习笔记 一. 常用命令 LINUX常用操作命令和命令行编辑快捷键 终端快捷键: Ctrl + a/Home 切换到命令行开始 Ctrl + e/End 切换到命令行 ...

  6. LINUX学习笔记:31个常用LINUX命令和相关解释

    LINUX学习笔记三: 最近在带新同事,是一个刚入行的萌新,对于linux不是很熟悉,问我怎么来学习. 所以今天接着之前的部分,继续分享一些linux学习资料.有需要的点点保存,没有跳过呗.PS:内容 ...

  7. 2018大数据培训学习路线图(详细完整版)

    2018大数据培训学习路线全课程目录+学习线路详解(详细完整版) 第一阶段:大数据基础Java语言基础阶段 1.1:Java开发介绍 1.1.1 Java的发展历史 1.1.2 Java的应用领域 1 ...

  8. linux学习第十周总结

    linux学习第十周总结 接着上周的mysql,重点终结日志管理 ,备份还原,主从复制和mysql集群 一.mysql日志管理 事务日志 transaction log 错误日志 error log ...

  9. Linux学习(Kali为蓝本)

    Linux学习记录 前言 这部分主要是Linux指令的学习和记录,都是些常用的或者不太便于记忆的指令.其他常用的如果没有记录到里面那就是已经记在我脑子里了- 基础指令(重点) 1.ls指令 含义:ls ...

  10. Linux学习05---文件管理系统

    文章目录 分区与文件系统 分区类型 文件系统 文件系统常见命令 df 文件系统查看命令 du 统计目录或文件大小命令 fsck 文件系统修复命令 dumpe2fs 显示磁盘状态命令 挂载命令:moun ...

最新文章

  1. 领域驱动应对业务复杂度
  2. Windows Store App JavaScript 开发:获取文件和文件夹列表
  3. linux 查看显卡信息
  4. 后端传输大量log数据_京东智联云MySQL读写分离最佳实践 ,轻松搞定数据库高性能扩展...
  5. CTFshow 命令执行 web34
  6. linux第9天 UDP
  7. PHP中上传文件文件名乱码
  8. 前端学习(501):水平居中布局得第二种方式的优缺点
  9. VS2010利用MFC的MSCcom控件的方法(WIN8系统)
  10. Grasshopper Essential Training Grasshopper基础教程 Lynda课程中文字幕
  11. SpringBoot项目打包成jar后,使用ClassPathResource获取classpath(resource)下文件失败
  12. 写作小技能:知识工作者的全套手艺
  13. 你测试OK了吗——浅谈测试通过标准
  14. 闭关修炼21天,“啃完”283页pdf,我终于4面拿下字节跳动offer
  15. ArcGis实战:土地利用变化矩阵与土地利用变化图制作
  16. win 7 64位系统安装java jdk 遇到could not find the required version of the java 2 runtime environment 错误
  17. 《计算机组成与系统结构(第二版) 裘雪红 李伯成 西安电子科技大学出版社》课后习题答案(带解析)(二)
  18. 2022年全国职业院校技能大赛“网络安全”竞赛试题官方答案
  19. 计算机可爱的企鹅教案,《可爱的小企鹅》教案
  20. 【数据福利】三种冰川编目数据

热门文章

  1. mysql的槽_Mysql槽点 - MySQL及其它开源数据库 - ITPUB论坛-中国专业的IT技术社区...
  2. mysql join 条件_MySQL Join 竟然可以这么玩?根据条件 进行复制
  3. console查看对象结构
  4. [原创]物探小宽线坐标快速生成(平行线坐标互算 、点到线距离计算、两线交点计算等)...
  5. 模型参数太多怎么办?用谷歌高效训练库GPipe啊
  6. NVIDIA DGX低至7.5折限时抢购,全球首款深度学习超级计算机组合
  7. 你的广告能打几分?Kaggle需求预测挑战赛冠军方案这样做丨教程
  8. 景驰无人车披露最新技术进展,2年后开启国内规模化运营 | 视频
  9. 一次sendmsg的改造过程
  10. 微信小程序第三方平台和附近的小程序将开放