zoukankan      html  css  js  c++  java
  • 马哥博客作业第十二周

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

      1)、首先创建角色相关文件夹 

      [root@CentOS7 ~]#tree /roles/
      /roles/
      └── httpd
       ├── files
       ├── handlers
       └── tasks

      2)、创建角色相关文件(main.yml是tasks的入口文件) 

      [root@CentOS7 httpd]#cat tasks/main.yml
      - include: install.yml
      - include: config.yml
      - include: modify.yml
      - include: index.yml
      - include: service.yml

      [root@CentOS7 httpd]#cat tasks/install.yml
      - name: install httpd
        yum: name=httpd

     

      [root@CentOS7 httpd]#cat tasks/config.yml
      - name: install configure file
        copy: src=httpd.conf dest=/etc/httpd/conf/

      [root@CentOS7 httpd]#cat tasks/modify.yml
      - name: modify config
        lineinfile:
            path: /etc/httpd/conf/httpd.conf
            regexp: "^Listen"
            line: "Listen 8088"
        notify: restart service

      [root@CentOS7 httpd]#cat tasks/index.yml
      - name: web page
        copy: src=index.html dest=/var/www/html/

      [root@CentOS7 httpd]#cat tasks/service.yml
      - name: start service
        service: name=httpd state=started enabled=yes

      [root@CentOS7 httpd]#cat handlers/main.yml
      - name: restart service
        service: name=httpd state=restarted

      3)、在files目录下准备两个文件

      [root@CentOS7 httpd]#ls files/
      httpd.conf index.html

      4)、目录树结构如下

      [root@CentOS7 ~]#tree roles/httpd/
      roles/httpd/
      ├── files
      │   ├── httpd.conf
      │   └── index.html
      ├── handlers
      │   └── main.yml
      └── tasks
      ├── config.yml
      ├── index.yml
      ├── install.yml
      ├── main.yml
      ├── modify.yml
      └── service.yml

      3 directories, 9 files

      5)、在playbook中调用角色 

      [root@CentOS7 ~]#cat role_httpd.yml
      ---
      # role httpd install
      - hosts: 10.0.0.211
        remote_user: root
        gather_facts: no

        roles:
          - httpd

      6)、运行playbook

      [root@CentOS7 ~]#ansible-playbook role_httpd.yml 

      

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

    • 客户端发送一条查询给服务器;
    • 服务器先检查查询缓存,如果命中了缓存,则立刻返回存储在缓存中的结果。否则进入下一阶段。
    • 服务器端进行SQL解析、预处理,在优化器生成对应的执行计划;
    • mysql根据优化器生成的执行计划,调用存储引擎的API来执行查询。
    • 将结果返回给客户端。

     

    3、SELECT 语句的完整语法较复杂,但至少包括的部分是 ( A )

      A.仅SELECT

      B.SELECT ,FROM

      C.SELECT ,GROUP

      D.SELECT ,INTO

     

    4、一张表的主键个数为 ( C )

      A.至多 3 个

      B.没有限制

      C.至多 1 个

      D.至多 2 个

  • 相关阅读:
    lvs+nginx负载均衡
    数据库读写分离、分表分库——用Mycat
    RocketMQ最佳实战
    几个常用类
    Future复习笔记
    线程池复习笔记
    HashMap 和 ConcurrentHashMap比较
    HTTP长连接和短连接(转)
    咨询
    RocketMQ 问题汇总
  • 原文地址:https://www.cnblogs.com/babyblue3/p/13511552.html
Copyright © 2011-2022 走看看