结尾
这不止是一份面试清单,更是一种”被期望的责任“,因为有无数个待面试者,希望从这篇文章中,找出通往期望公司的”钥匙“,所以上面每道选题都是结合我自身的经验于千万个面试题中经过艰辛的两周,一个题一个题筛选出来再次对好答案和格式做出来的,面试的答案也是再三斟酌,深怕误人子弟是小,影响他人仕途才是大过,也希望您能把这篇文章分享给更多的朋友,让他帮助更多的人,帮助他人,快乐自己,最后,感谢您的阅读。
由于细节内容实在太多啦,在这里我花了两周的时间把这些答案整理成一份文档了,在这里只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容!
[root@master lamp]# vim /etc/ansible/ansible.cfg
inventory = /etc/ansible/inventory
[root@master lamp]# cat /etc/ansible/inventory
[php]
192.168.129.137
[mysql]
192.168.129.135
[httpd]
192.168.129.133
- httpd、mysql、php步骤一样
[root@master ~]# ssh-copy-id root@192.168.129.133
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
root@192.168.129.133’s password:
Number of key(s) added: 1
Now try logging into the machine, with: “ssh ‘root@192.168.129.133’”
and check to make sure that only the key(s) you wanted were added.
[root@master ~]# ssh-agent bash
[root@master ~]# ssh-add
Enter passphrase for /root/.ssh/id_rsa:
Identity added: /root/.ssh/id_rsa (root@master)
[root@master ~]# ansible httpd -m yum -a ‘name=httpd* state=installed’
192.168.129.133 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“msg”: “”,
“rc”: 0,
“results”: [
“Installed: mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64”,
“Installed: cyrus-sasl-devel-2.1.27-1.el8.x86_64”,
“Installed: expat-devel-2.2.5-3.el8.x86_64”,
“Installed: apr-1.6.3-11.el8.x86_64”,
“Installed: apr-devel-1.6.3-11.el8.x86_64”,
“Installed: libdb-devel-5.3.28-40.el8.x86_64”,
“Installed: apr-util-1.6.1-6.el8.x86_64”,
“Installed: httpd-tools-2.4.37-39.module_el8.4.0+778+c970deab.x86_64”,
“Installed: apr-util-bdb-1.6.1-6.el8.x86_64”,
“Installed: openldap-devel-2.4.46-11.el8.x86_64”,
“Installed: apr-util-devel-1.6.1-6.el8.x86_64”,
“Installed: httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64”,
“Installed: apr-util-openssl-1.6.1-6.el8.x86_64”,
“Installed: centos-logos-httpd-85.8-1.el8.noarch”,
“Installed: httpd-devel-2.4.37-39.module_el8.4.0+778+c970deab.x86_64”,
“Installed: httpd-filesystem-2.4.37-39.module_el8.4.0+778+c970deab.noarch”,
“Installed: httpd-manual-2.4.37-39.module_el8.4.0+778+c970deab.noarch”
]
}
//开启服务与开机自启
[root@master ~]# ansible httpd -m service -a “name=httpd state=started enabled=yes”
192.168.129.133 | SUCCESS => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: false,
“enabled”: true,
“name”: “httpd”,
“state”: “started”,
“status”: {
“ActiveEnterTimestamp”: “Mon 2021-07-19 19:12:12 CST”,
“ActiveEnterTimestampMonotonic”: “1076238167”,
“ActiveExitTimestampMonotonic”: “0”,
……略
[root@master ~]# ansible mysql -m yum -a ‘name=mariadb state=present’
192.168.129.135 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“msg”: “”,
“rc”: 0,
“results”: [
“Installed: mariadb-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”,
“Installed: mariadb-common-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”,
“Installed: mariadb-connector-c-3.0.7-1.el8.x86_64”,
“Installed: mariadb-connector-c-config-3.0.7-1.el8.noarch”
]
}
//安装mariadb-server
[root@master ~]# ansible mysql -m yum -a ‘name=mariadb-server state=present’
192.168.129.135 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“msg”: “”,
“rc”: 0,
“results”: [
“Installed: mariadb-errmsg-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”,
“Installed: mariadb-gssapi-server-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”,
“Installed: mariadb-server-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”,
“Installed: mariadb-server-utils-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”,
“Installed: perl-DBD-MySQL-4.046-3.module+el8.1.0+2938+301254e2.x86_64”,
“Installed: mariadb-backup-3:10.3.17-1.module+el8.1.0+3974+90eded84.x86_64”
]
}
//开启服务于开机自启
[root@master ~]# ansible mysql -m service -a ‘name=mariadb state=started enabled=yes’
192.168.129.135 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“enabled”: true,
“name”: “mariadb”,
“state”: “started”,
“status”: {
“ActiveEnterTimestampMonotonic”: “0”,
“ActiveExitTimestampMonotonic”: “0”,
……略
[root@master ~]# ansible php -m yum -a ‘name=php state=present’
192.168.129.137 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“msg”: “”,
“rc”: 0,
“results”: [
“Installed: apr-util-bdb-1.6.1-6.el8.x86_64”,
“Installed: httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64”,
“Installed: apr-util-openssl-1.6.1-6.el8.x86_64”,
“Installed: centos-logos-httpd-85.8-1.el8.noarch”,
“Installed: httpd-filesystem-2.4.37-39.module_el8.4.0+778+c970deab.noarch”,
“Installed: httpd-tools-2.4.37-39.module_el8.4.0+778+c970deab.x86_64”,
“Installed: nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch”,
“Installed: php-fpm-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64”,
“Installed: php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64”,
“Installed: php-common-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64”,
“Installed: mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64”,
“Installed: php-cli-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64”,
“Installed: apr-1.6.3-11.el8.x86_64”,
“Installed: apr-util-1.6.1-6.el8.x86_64”
]
}
//安装php相关组件
[root@master ~]# ansible php -m yum -a ‘name=php-* state=present’
192.168.129.137 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“msg”: “”,
“rc”: 0,
……略
[root@master ~]# ansible httpd -m lineinfile -a ‘path=/etc/httpd/conf/httpd.conf line=“<VirtualHost :80>\nDocumentRoot “/var/www/html/www1”\nServerName www.192.168.129.133.com\nProxyRequests off\nProxyPassMatch ^/(..php)$ fcgi://192.168.129.137:9000/var/www/html/www1/$1\n<Directory “/var/www/html/www1”>\nOptions None\nAllowOverride None\nOrder allow,deny\nAllow from all\n\n”’
192.168.129.133 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“backup”: “”,
“changed”: true,
“msg”: “line added”
}
//在http主机上查看
[root@httpd conf]# cat /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot “/var/www/html/www1”
ServerName www.192.168.129.133
ProxyRequests Off
ProxyPassMatch ^/(.*.php)$ fcgi://192.168.129.137:9000/var/www/html/www1$1
<Directory “/var/www/html/www1”>
Options none
AllowOverride none
Require all granted
[root@master ~]# ansible httpd -m lineinfile -a ‘path=/etc/httpd/conf/httpd.conf regexp=“^AddType " insertafter=”^AddType application/x-" line=“AddType application/x-httpd-php .php”’
192.168.129.133 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“backup”: “”,
“changed”: true,
“msg”: “line added”
}
[root@master ~]# ansible httpd -m lineinfile -a ‘path=/etc/httpd/conf/httpd.conf regexp=“^AddType " insertafter=”^AddType application/x-" line=“AddType application/x-httpd-php-source .phps”’
192.168.129.133 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“backup”: “”,
“changed”: true,
“msg”: “line replaced”
}
[root@master ~]# ansible httpd -m lineinfile -a ‘path=/etc/httpd/conf/httpd.conf regexp=“^DirectoryIndex” line=“DirectoryIndex index.html index.php”’
192.168.129.133 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“backup”: “”,
“changed”: true,
“msg”: “line added”
}
[root@httpd]# vi /etc/httpd/conf/httpd.conf
probably should define those extensions to indicate media types:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php
Proxyrequests Off
ProxyPassMatch ^/(.*.php)$ fcgi://192.168.129.137:9000/var/www/html/$1
//重启服务
[root@master ~]# ansible httpd -m service -a ‘name=httpd state=restarted’
192.168.129.133 | CHANGED => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/libexec/platform-python”
},
“changed”: true,
“name”: “httpd”,
“state”: “started”,
“status”: {
……略
最后
做任何事情都要用心,要非常关注细节。看起来不起眼的、繁琐的工作做透了会有意想不到的价值。
当然要想成为一个技术大牛也需要一定的思想格局,思想决定未来你要往哪个方向去走, 建议多看一些人生规划方面的书籍,多学习名人的思想格局,未来你的路会走的更远。
更多的技术点思维导图我已经做了一个整理,涵盖了当下互联网最流行99%的技术点,在这里我将这份导图分享出来,以及为金九银十准备的一整套面试体系,上到集合,下到分布式微服务
最后
做任何事情都要用心,要非常关注细节。看起来不起眼的、繁琐的工作做透了会有意想不到的价值。
当然要想成为一个技术大牛也需要一定的思想格局,思想决定未来你要往哪个方向去走, 建议多看一些人生规划方面的书籍,多学习名人的思想格局,未来你的路会走的更远。
更多的技术点思维导图我已经做了一个整理,涵盖了当下互联网最流行99%的技术点,在这里我将这份导图分享出来,以及为金九银十准备的一整套面试体系,上到集合,下到分布式微服务
[外链图片转存中…(img-UmTWNhq8-1715810301212)]
[外链图片转存中…(img-UPiUR3nH-1715810301212)]
[外链图片转存中…(img-6lGeyq3s-1715810301212)]
[外链图片转存中…(img-h3OUCcJd-1715810301213)]