Script nén log file, sau đó move sang thư mục backup
Gồm 2 script, cơ chế: – Dọn nén các file .log trong folder chứa log, ở đây là /opt/batch/<tên batch>/log (Điều chỉnh tron file chạy chính) – Sau khi nén […]
Gồm 2 script, cơ chế: – Dọn nén các file .log trong folder chứa log, ở đây là /opt/batch/<tên batch>/log (Điều chỉnh tron file chạy chính) – Sau khi nén […]
Bước 1: cần có 1 con bot trên telegram, cách tạo bot các bạn chat với @botfather và làm theo hướng dẫn. Sau khi thực hiện, sẽ có token trả […]
1. DRBD là gì? DRBD viết tắt của Distributed Replicated Block Device, là một tiện ích sử dụng để nâng cao tính sẵn sàng của hệ thống. Nó là được […]
1 2 3 |
Môi trường thực hiện: Centos 7 ổ cứng mới = 80GB mount point = /net |
kiểm tra ổ đĩa mới thêm bằng fdisk -l
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[root@localhost ~]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000b1107 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 41943039 19921920 8e Linux LVM Disk /dev/sdb: 85.9 GB, 85899345920 bytes, 167772160 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes [root@localhost ~]# |
Thấy phần ổ đĩa mới: Disk /dev/sdb: 85.9 GB, 85899345920 bytes, 167772160 sectors gõ: fdisk /dev/sdb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
[root@localhost ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xa07e2d9e. Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-167772159, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-167772159, default 167772159): Using default value 167772159 Partition 1 of type Linux and of size 80 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@localhost ~]# |
Đã tạo xong phân vùng, tiến hành format sang […]
Thông tin hệ thống: Gồm 3 node: c2s-mapr-01 10.0.0.117 c2s-mapr-02 10.0.0.118 c2s-mapr-03 10.0.0.119 OS: centos 6 mapr version: 5.0 Hướng dẫn phân vùng ổ đĩa để thực hiện việc cài […]
1 2 3 |
apt install nfs-kernel-server -y mkdir -p /opt/backup chmod 777 /opt/backup |
Sửa file /etc/exports
1 |
/opt/backup *(rw) |
bật service
1 2 |
systemctl enable nfs-kernel-server systemctl restart nfs-kernel-server |
Mở FW cho ESXi kết nối tới
1 |
ufw allow from 192.168.1.252 |
Chương trình được viết bằng python Hướng dẫn cài đặt:
1 2 3 4 5 6 7 8 9 10 11 |
Cài đặt python3, và các gói cần thiết yum install epel-release -y & yum install python36 python36-pip.noarch -y && pip3 install requests Cách chạy app, sau khi thay cấu hình trong file config.py cd <đường dẫn thư mục app> python3 monitor_simple.py Cách thiết lập chạy mỗi phút 1 lần: crontab -l Thêm vào dòng sau: * * * * * /usr/bin/python3 <đường dẫn file monitor_simple.py> |
Download: https://github.com/khachuy2705/monitor_simple
Tương tự ufw, iptable của centos, ubuntu, ESXi cũng có firewall của riêng mình. Mặc định ESXi đã tạo sẵn 1 số rule, chúng ta có thể thao tác với […]
Cú pháp cơ bản:
1 2 3 4 5 6 7 8 9 10 11 |
. 1 ký tự bất kỳ, ngoại trừ xuống dòng \. dấu chấm (\ thể hiện escape) \d Một ký tự số \D Một ký tự không phải là số \w Một chữ hoặc số \W Một ký tự không phải là chữ \s một Dấu cách \S Một ký tự không phải dấu cách \b 1 từ nguyên vẹn \n Xuống dòng \t Tab |
Modifiers
1 2 3 4 5 6 7 |
$ Bắt đầu chuỗi ^ bắt đầu chuỗi ab|cd Matches ab hoặc cd. [ab-d] Match a và match các ký tự từ b --> d = bcd [^ab-d] One character except: a, b, c, d () Items within parenthesis are retrieved (a(bc)) Items within the sub-parenthesis are retrieved |
Repetitions
1 2 3 4 5 6 |
[ab]{2} Exactly 2 continuous occurrences of a or b [ab]{2,5} 2 to 5 continuous occurrences of a or b [ab]{2,} 2 or more continuous occurrences of a or b + One or more * Zero or more ? 0 or 1 |
PXE (Preboot eXecution Environment) Server cho phép cài đặt OS qua network, có thể thiết lập tự động chọn các cấu hình ban đầu khi cài đặt OS. Lợi ích […]