第12周作业
1、通过ansible Roles编排实现 httpd 角色的部署
mkdir -pv /data/ansible/roles/httpd/{tasks,handlers,files}
cd /data/ansible/roles/httpd/
vim tasks/main.yml
- include: group.yml
- include: user.yml
- include: install.yml
- include: config.yml
- include: index.yml
- include: service.yml
vim tasks/group.yml
- name: create apache group
group: name=apache system=yes gid=80
vim tasks/user.yml
- name: create apache user
user: name=apache system=yes shell=/sbin/nologin home=/var/www/ uid=80 group=apache
vim tasks/install.yml
- name: install httpd packge
yum: name=httpd
vim tasks/config.yml
- name: config file
copy: src=httpd.conf dest=/etc/httpd/conf/ backup=yes
notify: restart
vim tasks/index.yml
- name: index.html
copy: src=index.html dest=/var/www/html/
vim tasks/service.yml
- name: start service
service: name=httpd state=started enabled=yes
vim handlers/main.yml
- name: restart
service: name=httpd state=restarted
vim /data/ansible/role_httpd.yml
---
- hosts: all
remote_user: root
roles:
- httpd
ansible-playbook /data/ansible/role_httpd.yml
2、简述 MySQL 数据库访问的执行过程。
客户端发送一条查询给服务器;
服务器先会检查查询缓存,如果命中了缓存,则立即返回存储在缓存中的结果。否则进入下一阶段;
服务器端进行SQL解析、预处理,再由优化器生成对应的执行计划;
MySQL根据优化器生成的执行计划,调用存储引擎的API来执行查询;
3、S E L E C T 语句的完整语法较复杂,但至少包括的部分是 ( B )
A.仅 S E L E C T
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 个