Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand ansible automatic operation and maintenance database

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to understand the ansible automatic operation and maintenance database. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

Check the database host and the database table space simply by ansible, on the premise that the database host has a unified user name and password.

Operation and maintenance environment: rhel 7.2, ansible 1.9

Database environment: Oracle 11.2.0.4, Suse 11sp4, unified users are Oracle and usercs

Ansible configuration file / etc/ansible/ansible.cfg, otherwise you need to define the host location when running ansible

-- configure host groups

[root@DBAMONITOR usercs] # more / ansible/hosts

[Suse]

192.168.15.21

192.168.15.22

192.168.15.46

192.168.15.47

-- simple testing

[root@DBAMONITOR .ssh] # ansible Suse-m ping-u usercs-k

SSH password:

192.168.15.22 | success > > {

"changed": false

"ping": "pong"

}

192.168.15.46 | success > > {

"changed": false

"ping": "pong"

}

192.168.15.47 | success > > {

"changed": false

"ping": "pong"

}

192.168.15.21 | success > > {

"changed": false

"ping": "pong"

}

-- View the space

[root@DBAMONITOR .ssh] # ansible Suse-m command-a "df-hT"-u usercs-k

Password:

[root@DBAMONITOR .ssh] # ansible Suse-m command-a "ls-l / tmp"-u usercs-k

Password:

-- copy the file:

[root@DBAMONITOR .ssh] # ansible Suse-m copy-a "src=/etc/ansible/ansible.cfg dest=/tmp/ansible.cfg"-u usercs-k

Password:

{"src=/etc/ansible/ansible.cfg dest=/tmp/ansible.cfg owner=usercs group=usercs mode=0644"}

-- execute scripts remotely

Ansible Suse-m shell-a "/ tmp/rocketzhang_test.sh"

Password:

-- create a directory remotely

Ansible Suse-m command-a "mkdir / home/oracle/scripts"-u oracle-k

Password:

-- configuration script

Source / .profile

Sqlplus-S "/ as sysdba"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report