Linux system service and Management (services)---------Day Sixth

Source: Internet
Author: User
Tags inotify rsync

??? virtual Machine A

? ? 1. Set the firewall state to trusted

? 2.SELinux currently modified to permissive

? 3.SELinux permanent status modified to permissive

? ? 4. Clear the Yum cache to check if Yum is available


? ? Virtual Machine B

? ? 1. Set the firewall state to trusted

? 2.SELinux currently modified to permissive

? 3.SELinux permanent status modified to permissive

? ? 4. Clear the Yum cache to check if Yum is available


? ? /etc/selinux/config (Permanent status profile)


rsync sync operation

? Command usage

??? –rsync [Options ...] source directory destination Directory


? Differences in synchronization and replication

? ? ? ? – Copy: Full copy Source to target

? ? ? ? – Sync: Incremental copy, transfer only changed data




? Local synchronization

? ? –rsync [Options ...] local directory 1? Local directory 2?? Synchronizing the entire folder


? ? –rsync [Options ...] local directory 1/? Local directory 2? Synchronize only the data in the directory


? rsync operation Options

–-n: Testing the synchronization process without actual modification

–--delete: Delete Unnecessary documents in the destination folder

–-A: Archive mode, equivalent to-rlptgod

–-V: Show detailed operation information

–-z: Enable compression/decompression during transfer




? # MKDIR/ABC

? # Mkdir/test

? # Cp/etc/passwd/etc/fstab/etc/shadow?/etc/group?/abc/


? # ls/abc/

?

? # Ls/test

? # Rsync-avz/ABC?/test

? # Ls/test


? # Rsync-avz/abc/?/test

? # Ls/test


? # Echo 123 >>/abc/group

? # Rsync-avz/abc/?/test??? #只传输变化的数据


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



? Keep in sync with remote SSH directory

? ? – downlink: rsync [...] [Email protected]: remote directory?? Local Directory

? ? – Upstream: rsync [...] local directory?? [Email protected]: remote directory


? virtual Machine A:


# ls/abc/

Fstab group Haha.txt? passwd Shadow


# Rsync-avz--delete?/abc/? [Email protected]:/opt/



Virtual Machine B:


# ls/opt



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

? Real-time synchronization


? virtual Machine A:

? 1. Mima validation cancellation with public key private key validation

[[email protected] ~]# Ssh-keygen????? #一路回车, generate the public key private key


[Email protected] ~]# ls/root/.ssh/?? #公钥 private key is stored locally


[Email protected] ~]# Ssh-copy-id [email protected]? #拷贝公钥到对方


? 2. Verification

[[email protected] ~]# ssh [email protected]


3. INotify Real-time monitoring directory, content changes

? Operation on the real machine: inotify-tools-3.13.tar.gz upload to virtual machine a


? # SCP inotify-tools-3.13.tar.gz? [Email protected]:/root/



? Step 1: Install GCC, make

? [Email protected]/]# yum-y install gcc? make

? [Email protected]/]# rpm-q gcc

? [[email protected]/]# rpm-q make


Step 2:tar Unpacking, releasing the source code to the specified directory

? # rm-rf/opt/*

? # tar-xf/root/inotify-tools-3.13.tar.gz-c/opt/-----Large "C" is the location of the specified decompression

? # ls/opt/

? ? # All the following steps are to be performed in the Unzip directory


? Step 3:./configure configuration, specify the installation directory/function module and other options??

?? # CD? /opt/inotify-tools-3.13/

?? #./configure----indicates that the current environment is not fully satisfied by the system program being detected?


? step 4:make compile, generate executable binary program Files

?? # make

? step 5:make Install, copy the compiled files to the installation directory

?? # make Install


Authentication

[[email protected]/]# inotifywait??? #不提示, the command was not found.

No files specified to watch!??


? Basic usage

–inotifywait [Options] Destination folder

? Common Command Options

–-M, continuous monitoring (no exit after capturing an event)

–-r, recursive monitoring, including subdirectories and files

??? –-q, reduce the screen output information?

–-E, specifying event categories for monitored modify, move, create, delete, attrib, and more



# Rsync-avz--delete?/abc/? [Email protected]:/opt/


? Shell Script

??

[Email protected]/]# vim/root/rsync.sh


#!/bin/bash

? dir=/abc/

? While inotifywait?-rqq? $dir

? Do

? ? Rsync-az--delete? $dir? [Email protected]:/opt/

? Done



[Email protected]/]# chmod +x/root/rsync.sh


[Email protected]/]#/root/rsync.sh


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

? DNS separation Resolution? (view resolution)

? Split Separation Analysis


What is separation resolution

? When a client's DNS query request is received

??? – Ability to differentiate the source address of a client

??? – Provide different parsing results (IP addresses) for different classes of clients

??

?? Multiple view views, matching and stopping

?? All zone must be in view




??? To achieve separation resolution:

????????? SVR7 most DNS server


??? 192.168.4.207------->www.tedu.cn-----"1.2.3.4

????? Other client---------->www.tedu.cn-----"100.200.100.200

?

?

??

Virtual Machine A:

# vim/etc/named.conf


?? View "LAN" {

?? match-clients {192.168.4.207;};

? ? ? Zone? " Tedu.cn "? in {

?????? type Master;

?????? file "Tedu.cn.lan";

? ? ? ?};

? ? };


?? View "abc" {

?? match-clients {any;};

? ? Zone? " Tedu.cn "? in {

????? type Master;

????? file "Tedu.cn.abc";

? ? ? ?};

? ? ?};




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





? 192.168.4.207------->www.qq.com-----"10.10.10.10

? ? Other clients----------------->www.qq.com-----"20.20.20.20

?


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


? View the routing table in Linux


[Email protected]/]# route-n


















?
























































































Linux system service and Management (services)---------Day Sixth

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.