-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
275ddaf
commit 9363544
Showing
8 changed files
with
504 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## Raid | ||
|
||
### Raid 0(独立磁盘冗余阵列) | ||
|
||
- 必须使用两块或两块以上硬盘组成 | ||
- 每块硬盘的大小必须一致 | ||
- 是所有动态磁盘中,数据读写最快的 | ||
- 损坏几率相对最高 | ||
- 没有磁盘容错功能 | ||
|
||
### Raid 1 | ||
|
||
- 由两块或2的倍数硬盘组成 | ||
- 每块硬盘大小必须一致 | ||
- 硬盘使用率只有50%,写入速度最慢 | ||
- 拥有磁盘容错功能 | ||
|
||
### Raid 5 | ||
|
||
- 由三块或三块以上硬盘组成 | ||
|
||
- 每块硬盘大小必须一致 | ||
|
||
- 磁盘利用率是n-1块盘 | ||
|
||
- 利用奇偶校验,拥有磁盘容错功能(只支持1块硬盘损坏) | ||
|
||
### Raid 5的奇偶校验(异或校验) | ||
|
||
![image-20200507110118211](../../Images/image-20200507110118211.png) | ||
|
||
### Raid 6 | ||
|
||
- Raid 6是Raid 5的增强版 | ||
- 由4块或以上硬盘组成 | ||
- 每块硬盘大小必须一致 | ||
- 磁盘利用率是n-2块盘 | ||
- 支持磁盘容错,可以支持2块硬盘损坏 | ||
|
||
Raid 10 | ||
|
||
- 必须有4块等大小的硬盘组成 | ||
- 两两硬盘先组成Raid 1 ,再组成Raid 0 | ||
- 兼顾Raid 0和Raid 1的特点,中和两种Raid的缺点 | ||
|
||
### 软Raid与硬Raid的区别 | ||
|
||
- 软Raid:是由操作系统模拟的的Raid,一旦硬盘损坏,操作系统就会损坏,Raid会丧失作用。 | ||
- 硬Raid:是由独立于硬盘之外的,硬件Raid卡组成;就算硬盘损坏,也不会导致Raid卡损坏,磁盘容错才能起作用 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
## 备份策略 | ||
|
||
### 1. 需要备份的内容 | ||
|
||
#### 1.1 重要系统目录 | ||
|
||
- /etc/ | ||
- /home/ | ||
- /root/ | ||
- /var/spool/mail/ | ||
- /var/spool/cron/ | ||
- /var/spool/at/ | ||
|
||
### 2. 网络服务数据 | ||
|
||
#### 2.1 MySQL数据库 | ||
|
||
RPM包安装的MySQL:/var/lib/mysql/ | ||
|
||
源码包安装的MySQL:/usr/local/mysql/data/ | ||
|
||
#### 2.2 Apache服务 | ||
|
||
网站内容: | ||
|
||
- /var/www/html/ | ||
|
||
- /usr/local/apache2/htdocs/ | ||
|
||
配置文件: | ||
|
||
- /etc/httpd/conf/httpd.conf/ | ||
|
||
- usr/local/apache2/conf/httpd.conf | ||
|
||
日志文件: | ||
|
||
- /var/log/httpd/ | ||
- /usr/local/apache2/logs | ||
- 如果有其他服务,也需要备份重要数据 | ||
|
||
### 3. 备份策略完整备份 | ||
|
||
实现命令:cp、tar、dump、xfsdump | ||
|
||
#### 3.1 增量备份: | ||
|
||
每次备份以前一次备份作为参照 | ||
|
||
实现命令: | ||
|
||
CentOS 6.x:dump工具 | ||
|
||
实现命令: | ||
|
||
CentOS 7.x:xfsdump工具 | ||
|
||
#### 3.2 差异备份: | ||
|
||
每次备份以第一次备份作为参照 | ||
|
||
实现命令: | ||
|
||
CentOS 6.x:dump工具 | ||
|
||
实现命令: | ||
|
||
CentOS 7.x:xfsdump工具 | ||
|
||
### 4. 备份频率 | ||
|
||
实时备份:如MySQL主从同步 | ||
|
||
定时备份:如每天、每周备份,一般通过“脚本+定时任务”实现 | ||
|
||
### 5. 备份存储位置 | ||
|
||
基本原则:不要把鸡蛋放在同一个篮子中 | ||
|
||
- 本地备份 | ||
|
||
- 异地备份 | ||
|
||
### 6. 常见服务器的备份方案 | ||
|
||
1. 每日备份的数据(异地备份) | ||
|
||
- MySQL数据库(主从备份之外,增量备份一次) | ||
|
||
2. 每周备份的数据(异地备份) | ||
|
||
- MySQL数据库(完整备份) | ||
|
||
- 重要系统数据 | ||
|
||
- 网页数据 | ||
- 其他服务相关数据 | ||
|
||
### 7. 日志的切割与轮替 | ||
|
||
系统日志管理工具:logrotate | ||
|
||
- 日志切割 | ||
|
||
- 日志轮替 | ||
|
||
> Apache服务配置文件自带日志切割功能,但是需要通过脚本进行轮替 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## 权限优化 | ||
|
||
- 注意权限分离(Linux系统权限、数据库权限不要掌握在同一个部门) | ||
- 权限在满足使用的情况下,最小优先 | ||
- 减少使用root用户,尽量用“普通用户 + sudo提权”进行日常操作 | ||
- 重要系统文件,如:`/etc/passwd`、`/etc/shadow`、`/etc/fstab`、`/etc/sudoers`等,日常建议使用chattr锁定,需要操作时再打开 | ||
- 使用脚本检测系统中新增的SUID、SGID文件 | ||
- 可以利用工具(如chkrootkit等)检测rootkit脚本 | ||
- 开启SSH服务秘钥对登录,修改SSH服务端口 | ||
|
||
[Linux系统权限总结.pdf](Linux系统权限总结.pdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Linux系统优化策略 | ||
|
||
- 禁用不需要的服务 | ||
- ntsysv命令最为方便 | ||
|
||
- 避免直接使用root用户,普通用户通过sudo授权操作 | ||
- 通过chattr锁定重要系统文件 | ||
- /etc/passwd | ||
- /etc/shadow | ||
- /etc/group | ||
- /etc/gshadow | ||
- /etc/inittab | ||
|
||
- 配置国内yum源,加快下载速度 | ||
- 配置系统同时打开最大文交数 | ||
- vi /etc/profile | ||
- ulimit -SHn 65535 | ||
|
||
- 同步时间服务器 | ||
- ntpdate ntp1.aliyun.com | ||
- 通过crond定时任务,让时间同步命令每5分钟执行一次 | ||
|
||
- 更改ssh服务的默认端口,配置SSH秘钥对登录 | ||
- 配置合理的IPtables防火墙规则 | ||
- 配置合理的SELinux安全上下文 | ||
- 指定合理的监控策略 | ||
- 定时备份系统重要文件 |
Oops, something went wrong.