1、通过ansible Roles编排实现 httpd 角色的部署
##剧本文件结构创建
mkdir -pv /data/ansible/roles/httpd/{tasks,handlers,files}
mkdir -pv /data/ansible/roles/httpd/tasks/{config.yml,group.yml,index.yml,install.yml,main.yml,service.yml,user.yml}
mkdir -pv /data/ansible/roles/httpd/handlers/main.yml
##http服务主剧本模块定义
cat main.yml
- include: group.yml
- include: user.yml
- include: install.yml
- include: config.yml
- include: index.yml
- include: service.yml
##http服务组创建
cat group.yml
- name: create apache group
group: name=apache system=yes gid=80
##http服务用户创建
cat user.yml
- name: create apache user
user: name=apache system=yes shell=/sbin/nologin home=/var/www/ uid=80 group=apache
##http服务包安装
cat install.yml
- name: install httpd package
yum: name=httpd
##http服务配置文件拷贝触发器定义
cat config.yml
- name: config file
copy: src=httpd.conf dest=/etc/httpd/conf backup=yes
notify: restart
##http服务测试页面拷贝
cat index.yml
- name: index.html
copy: src=index.html dest=/var/www/html/
##http服务启动
cat service.yml
- name: start service
service: name=httpd state=started enabled=yes
##http服务触发器调用重启
cat ../handlers/main.yml
- name: restart
service: name=httpd state=restarted
##http服务测试页面配置
echo "httpd base ansbile" > /data/ansible/roles/httpd/files/index.html
ll -s /data/ansible/roles/httpd/filescat
httpd.conf index.html
##剧本调用
cat role_httpd.yml
---
#httpd role
- hosts: appssrc
remote_user: root
roles:
- httpd
注意需要配置: /etc/ansible/hosts
[appssrc]
10.0.0.8
10.0.0.7
##测试剧本
ansible-playbook -C /data/ansible/role_httpd.yml
##安装
ansible-playbook /data/ansible/role_httpd.yml
##测试http服务
curl 10.0.0.7
curl 10.0.0.8
2、简述 MySQL 数据库访问的执行过程。
1.客户端与数据库服务通信(连接器)
2.查询缓存(缓存)
3.查询优化处理(分析器,优化器,执行器)
4.调用存储引擎(引擎接口)
5.返回客户端
3、S E L E C T 语句的完整语法较复杂,但至少包括的部分是 (B )
A.仅 S E L E C
B.S E L E C T ,F R O M
C.S E L E C T ,G R O U P
D.S E L E C T ,I N T O
4、一张表的主键个数为 ( C)
A.至多 3 个 B.没有限制
C.至多 1 个 D.至多 2 个