日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

ansible备份mysql_ansible做mysql备份和安全加固

發布時間:2023/12/4 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ansible备份mysql_ansible做mysql备份和安全加固 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

1. mysql備份

A patch adding name=all was added to the mysql_db module on May 12, 2015, so the recommended way to dump all databases is:

# Dumps all databases to hostname.sql

- mysql_db: state=dump name=all target=/tmp/{{ inventory_hostname }}.sql

每個數據庫一個文件:

---

# This playbook backups all mysql databases into separate files.

- name: backup mysql

vars:

- exclude_db:

- "Database"

- "information_schema"

- "performance_schema"

- "mysql"

tasks:

- name: get db names

shell: 'mysql -u root -p{{ vault_root_passwd }} -e "show databases;" '

register: dblist

- name: backup databases

mysql_db:

state: dump

name: "{{ item }}"

target: "/tmp/{{ item }}.sql"

login_user: root

login_password: "{{ vault_root_passwd }}"

with_items: "{{ dblist.stdout_lines | difference(exclude_db) }}"

2. 安全加固

列一個提綱

Change the password for the root account

Create and configure a deploy user account

Configure ssh public key authentication for the deploy account

Add the deploy account to the sudoers list

Run apt-get update

Run apt-get upgrade

Package Installation

Configure automatic updates

Configure a firewall

Install and configure Logwatch

Lockdown ssh access

參考:

http://www.linuxjournal.com/content/security-hardening-ansible?page=0,3

http://ryaneschinger.com/blog/securing-a-server-with-ansible/

http://docs.openstack.org/developer/openstack-ansible-security/

http://stackoverflow.com/questions/28597029/ansible-how-to-backup-all-mysql-databases

總結

以上是生活随笔為你收集整理的ansible备份mysql_ansible做mysql备份和安全加固的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。