马哥博客作业第十二周

1、通过ansible Roles编排实现 httpd 角色的部署

[15:02:06 root@centos8 /data/ansible]#tree roles/
roles/
└── apache
    ├── files
    │   ├── httpd.conf
    │   └── index.html
    ├── handlers
    │   └── main.yml
    └── tasks
        ├── config.yml
        ├── group.yml
        ├── index.yml
        ├── install.yml
        ├── main.yml
        ├── service.yml
        └── user.yml

4 directories, 10 files
[15:01:00 root@centos8 /data/ansible]#ansible-playbook role_httpd.yml 

PLAY [websrv] *****************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************
ok: [10.0.0.7]
ok: [10.0.0.8]

TASK [groupadd apache] ********************************************************************************************
ok: [10.0.0.8]
ok: [10.0.0.7]

TASK [useradd apache] *********************************************************************************************
ok: [10.0.0.8]
ok: [10.0.0.7]

TASK [apache : install httpd] *************************************************************************************
ok: [10.0.0.7]
ok: [10.0.0.8]

TASK [apache : copy config file] **********************************************************************************
ok: [10.0.0.8]
ok: [10.0.0.7]

TASK [apache : copy index.html] ***********************************************************************************
ok: [10.0.0.8]
ok: [10.0.0.7]

TASK [apache : start httpd] ***************************************************************************************
ok: [10.0.0.7]
ok: [10.0.0.8]

PLAY RECAP ********************************************************************************************************
10.0.0.7                   : ok=7    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
10.0.0.8                   : ok=7    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 
[15:02:08 root@centos8 /data/ansible]#ansible websrv -a 'ss -ntl'
10.0.0.8 | CHANGED | rc=0 >>
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port    
LISTEN    0         128                0.0.0.0:22               0.0.0.0:*       
LISTEN    0         128                   [::]:22                  [::]:*       
LISTEN    0         128                      *:8088                   *:*       
10.0.0.7 | CHANGED | rc=0 >>
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port                                  
LISTEN     0      80        [::]:3306                  [::]:*                                
LISTEN     0      128       [::]:22                    [::]:*                                
LISTEN     0      128       [::]:8088                  [::]:*                

[
15:04:14 root@centos8 /data/ansible]#ansible websrv -a 'curl 127.0.0.1:8088' [WARNING]: Consider using the get_url or uri module rather than running 'curl'. If you need to use command because get_url or uri is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid of this message. 10.0.0.8 | CHANGED | rc=0 >> Apache for ansible % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19 100 19 0 0 19000 0 --:--:-- --:--:-- --:--:-- 19000 10.0.0.7 | CHANGED | rc=0 >> Apache for ansible % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19 100 19 0 0 23690 0 --:--:-- --:--:-- --:--:-- 19000

2、简述 MySQL 数据库访问的执行过程。

数据库访问过程可以分为以下步骤:
1.连接器,任何数据访问都需要客户端和服务端建立起连接才可以通信,而连接器是负责与客户端建立连接,获取权限,维持和管理连接.
2.查询缓存,如果之前已经查询过的数据,会缓存在一个特定的地方,经过连接器生成线程首先会查询缓存,这样可以减少查询时间和减少带宽消耗
3. 分析器,如果没有命中查询缓存,那么接下来就需要对SQL语句进行分析,生成多个有效的执行树.
4.优化器.每个执行树都可以查询到数据,但是要在多个访问路径之间找到最优的一个,就需要优化器去处理了,优化器要去衡量多个访问路径中开销最小的,从而决定选择哪一个访问路径
5.执行器.优化完sql语句后,开始执行的时候,会先判断对这个表有没有执行权限,如果没有,就返回错误,如果有,就继续执行.执行结束后,服务器获取到结果.

3、S E L E C T 语句的完整语法较复杂,但至少包括的部分是 (   A )

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 个

posted @ 2020-08-17 14:37  IRui  阅读(224)  评论(0编辑  收藏  举报