Nginx核心配置-自定义日志路径及清空日志注意事项

                                       作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.关于日志清空注意事项

1>.nginx服务写访问日志是基于access.log的inode写入的,而非基于文件名称写入

[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep              #首先确认nginx服务是启动的
root 2840 1 0 09:37 ? 00:00:00 nginx: master process nginx
nginx 3566 2840 0 10:56 ? 00:00:00 nginx: worker process
nginx 3567 2840 0 10:56 ? 00:00:00 nginx: worker process
nginx 3568 2840 0 10:56 ? 00:00:00 nginx: worker process
nginx 3569 2840 0 10:56 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/          #请注意观察access.log文件的inode编号
total 9048
34412586 -rw-r--r-- 1 root root 9231991 Dec 17 10:57 access.log
34412582 -rw-r--r-- 1 nginx nginx 28235 Dec 17 10:57 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# rm -f /yinzhengjie/softwares/nginx/logs/access.log     #此处我们将之前的access.log文件删除
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# touch /yinzhengjie/softwares/nginx/logs/access.log     #删除access.log文件后立即创建一个新的同名文件
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/           #文件名称的确是一样的,但是我们发现inode编号却发生了变化
total 32
34553569 -rw-r--r-- 1 root root 0 Dec 17 11:16 access.log
34412582 -rw-r--r-- 1 nginx nginx 28235 Dec 17 10:57 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/            #虽然我们可以删除和新建了access.log文件,但整个过程并不影响nginx服务的访问
<h1 style='color:rgb(255,0,255)'>Welcome to 'https://www.cnblogs.com/yinzhengjie/'</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/login/
<h1 style='color:rgb(255,0,0)'>Java</h1>
<h1 style='color:rgb(0,255,0)'>Python</h1>
<h1 style='color:rgb(0,0,255)'>Golang</h1>
<h1 style='color:rgb(255,0,255)'>Shell</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/            #我们在删除access.log并创建文件后,对nginx进行了两次正常访问,发现日志记录并没有记录,那是因为nginx服务还是记录之前的access.log的inode编号。
total 32
34553569 -rw-r--r-- 1 root root 0 Dec 17 11:16 access.log
34412582 -rw-r--r-- 1 nginx nginx 28235 Dec 17 10:57 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#

2>. 解决nginx服务的access.log无法写入的问题

[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep
root 2840 1 0 09:37 ? 00:00:00 nginx: master process nginx
nginx 3566 2840 0 10:56 ? 00:00:00 nginx: worker process
nginx 3567 2840 0 10:56 ? 00:00:00 nginx: worker process
nginx 3568 2840 0 10:56 ? 00:00:00 nginx: worker process
nginx 3569 2840 0 10:56 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/
<h1 style='color:rgb(255,0,255)'>Welcome to 'https://www.cnblogs.com/yinzhengjie/'</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/login/
<h1 style='color:rgb(255,0,0)'>Java</h1>
<h1 style='color:rgb(0,255,0)'>Python</h1>
<h1 style='color:rgb(0,0,255)'>Golang</h1>
<h1 style='color:rgb(255,0,255)'>Shell</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/        #我们之前使用rm命令删除并使用touch重新创建了access.log,发现始终无法正常记录日志了
total 32
34553569 -rw-r--r-- 1 root root 0 Dec 17 11:16 access.log
34412582 -rw-r--r-- 1 nginx nginx 28295 Dec 17 11:23 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -s reload
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep
root 2840 1 0 09:37 ? 00:00:00 nginx: master process nginx
nginx 3645 2840 3 11:23 ? 00:00:00 nginx: worker process
nginx 3646 2840 3 11:23 ? 00:00:00 nginx: worker process
nginx 3647 2840 4 11:23 ? 00:00:00 nginx: worker process
nginx 3648 2840 3 11:23 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/
<h1 style='color:rgb(255,0,255)'>Welcome to 'https://www.cnblogs.com/yinzhengjie/'</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/login/
<h1 style='color:rgb(255,0,0)'>Java</h1>
<h1 style='color:rgb(0,255,0)'>Python</h1>
<h1 style='color:rgb(0,0,255)'>Golang</h1>
<h1 style='color:rgb(255,0,255)'>Shell</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/                #发现使用"reload"命令行,又可以继续写入数据了
total 36
34553569 -rw-r--r-- 1 root root 183 Dec 17 11:23 access.log
34412582 -rw-r--r-- 1 nginx nginx 28295 Dec 17 11:23 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#

3>.删除access.log后,使用reload参数可以重写生成新的access.log(如果删除了error.log也一样在重启nginx时自动创建该文件)

[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 36
-rw-r--r-- 1 root root 183 Dec 17 11:23 access.log
-rw-r--r-- 1 nginx nginx 28295 Dec 17 11:23 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# rm -f /yinzhengjie/softwares/nginx/logs/access.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 32
-rw-r--r-- 1 nginx nginx 28295 Dec 17 11:23 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -s reload
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 32
-rw-r--r-- 1 root root 0 Dec 17 11:26 access.log
-rw-r--r-- 1 nginx nginx 28355 Dec 17 11:26 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/login/
<h1 style='color:rgb(255,0,0)'>Java</h1>
<h1 style='color:rgb(0,255,0)'>Python</h1>
<h1 style='color:rgb(0,0,255)'>Golang</h1>
<h1 style='color:rgb(255,0,255)'>Shell</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 36
33691734 -rw-r--r-- 1 root root 95 Dec 17 11:28 access.log
34412582 -rw-r--r-- 1 nginx nginx 28355 Dec 17 11:26 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#

4>.生产环境中正确的清空access.log日志的姿势

[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 36
33691734 -rw-r--r-- 1 root root 95 Dec 17 11:28 access.log
34412582 -rw-r--r-- 1 nginx nginx 28355 Dec 17 11:26 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# echo > /yinzhengjie/softwares/nginx/logs/access.log  #使用"echo"命令清空文件可以立即释放内存空间,若使用rm命令删除文件并不会立即释放空间,因为nginx服务还是在引用删除之前的acess.log的inode编号。
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 36
33691734 -rw-r--r-- 1 root root 1 Dec 17 11:31 access.log
34412582 -rw-r--r-- 1 nginx nginx 28355 Dec 17 11:26 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/login/
<h1 style='color:rgb(255,0,0)'>Java</h1>
<h1 style='color:rgb(0,255,0)'>Python</h1>
<h1 style='color:rgb(0,0,255)'>Golang</h1>
<h1 style='color:rgb(255,0,255)'>Shell</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 36
33691734 -rw-r--r-- 1 root root 96 Dec 17 11:31 access.log
34412582 -rw-r--r-- 1 nginx nginx 28355 Dec 17 11:26 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/
<h1 style='color:rgb(255,0,255)'>Welcome to 'https://www.cnblogs.com/yinzhengjie/'</h1>
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll -i /yinzhengjie/softwares/nginx/logs/
total 36
33691734 -rw-r--r-- 1 root root 184 Dec 17 11:31 access.log
34412582 -rw-r--r-- 1 nginx nginx 28355 Dec 17 11:26 error.log
34553544 -rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
[root@node101.yinzhengjie.org.cn ~]#

二.自定义访问日志路径

1>.编辑主配置文件

[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf/nginx.conf
worker_processes 4;
worker_cpu_affinity 00000001 00000010 00000100 00001000; events {
worker_connections 100000;
use epoll;
accept_mutex on;
multi_accept on;
} http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
charset utf-8;
keepalive_timeout 65 65; #导入其他路径的配置文件
include /yinzhengjie/softwares/nginx/conf.d/*.conf;
} [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#

2>.编辑子配置文件

[root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/nginx/conf.d/auth.conf
server {
listen 80;
server_name node101.yinzhengjie.org.cn; error_page 500 502 503 504 404 /error.html; access_log /yinzhengjie/softwares/nginx/logs/node101_yinzhengjie_org_cn_access.log;
error_log /yinzhengjie/softwares/nginx/logs/node101_yinzhengjie_org_cn_error.log; location / {
root /yinzhengjie/data/web/nginx/html;
index index.html;
} location /login {
root /yinzhengjie/data/web/nginx;
index index.html;
deny 172.30.1.108;
allow 172.30.1.0/24;
allow 2001:0db8::/32;
deny all;
} location /error.html {
root /yinzhengjie/data/web/nginx/html/404;
}
}
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -t
nginx: the configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /yinzhengjie/softwares/nginx/conf/nginx.conf test is successful
[root@node101.yinzhengjie.org.cn ~]#

3>.重新加载nginx服务

[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep
root 2840 1 0 09:37 ? 00:00:00 nginx: master process nginx
nginx 3715 2840 0 11:36 ? 00:00:00 nginx: worker process
nginx 3716 2840 0 11:36 ? 00:00:00 nginx: worker process
nginx 3717 2840 0 11:36 ? 00:00:00 nginx: worker process
nginx 3718 2840 0 11:36 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# nginx -s reload
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ps -ef | grep nginx | grep -v grep
root 2840 1 0 09:37 ? 00:00:00 nginx: master process nginx
nginx 3791 2840 2 11:56 ? 00:00:00 nginx: worker process
nginx 3792 2840 2 11:56 ? 00:00:00 nginx: worker process
nginx 3793 2840 2 11:56 ? 00:00:00 nginx: worker process
nginx 3794 2840 2 11:56 ? 00:00:00 nginx: worker process
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#

4>.访问nginx服务,观察日志大小变化

[root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/nginx/logs/
total 8
-rw-r--r-- 1 root root 0 Dec 17 11:37 access.log
-rw-r--r-- 1 root root 256 Dec 17 11:56 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
-rw-r--r-- 1 root root 0 Dec 17 11:53 node101_yinzhengjie_org_cn_access.log
-rw-r--r-- 1 root root 0 Dec 17 11:53 node101_yinzhengjie_org_cn_error.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -I http://node101.yinzhengjie.org.cn/
HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Tue, 17 Dec 2019 03:57:26 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 88
Last-Modified: Sun, 15 Dec 2019 15:13:15 GMT
Connection: keep-alive
Keep-Alive: timeout=65
ETag: "5df64d8b-58"
Accept-Ranges: bytes [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/nginx/logs/
total 12
-rw-r--r-- 1 root root 0 Dec 17 11:37 access.log
-rw-r--r-- 1 root root 256 Dec 17 11:56 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
-rw-r--r-- 1 root root 88 Dec 17 11:57 node101_yinzhengjie_org_cn_access.log
-rw-r--r-- 1 root root 0 Dec 17 11:53 node101_yinzhengjie_org_cn_error.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -I http://node101.yinzhengjie.org.cn/login
HTTP/1.1 301 Moved Permanently
Server: nginx/1.14.2
Date: Tue, 17 Dec 2019 03:57:46 GMT
Content-Type: text/html
Content-Length: 185
Location: http://node101.yinzhengjie.org.cn/login/
Connection: keep-alive
Keep-Alive: timeout=65 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/nginx/logs/
total 12
-rw-r--r-- 1 root root 0 Dec 17 11:37 access.log
-rw-r--r-- 1 root root 256 Dec 17 11:56 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
-rw-r--r-- 1 root root 378 Dec 17 11:57 node101_yinzhengjie_org_cn_access.log
-rw-r--r-- 1 root root 0 Dec 17 11:53 node101_yinzhengjie_org_cn_error.log
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# curl -I http://node101.yinzhengjie.org.cn/login/111111111
HTTP/1.1 404 Not Found
Server: nginx/1.14.2
Date: Tue, 17 Dec 2019 03:58:01 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1717
Connection: keep-alive
Keep-Alive: timeout=65
ETag: "5df84120-6b5" [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/nginx/logs/
total 16
-rw-r--r-- 1 root root 0 Dec 17 11:37 access.log
-rw-r--r-- 1 root root 256 Dec 17 11:56 error.log
-rw-r--r-- 1 root root 5 Dec 17 09:37 nginx.pid
-rw-r--r-- 1 root root 481 Dec 17 11:58 node101_yinzhengjie_org_cn_access.log
-rw-r--r-- 1 root root 272 Dec 17 11:58 node101_yinzhengjie_org_cn_error.log
[root@node101.yinzhengjie.org.cn ~]#

Nginx 核心配置-自定义日志路径及清空日志注意事项的更多相关文章

  1. Nginx 核心配置-自定义错误页面

    Nginx 核心配置-自定义错误页面 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 生产环境中错误页面一般都是UI或开发工程师提供的,他们已经在软件中定义好了,我们这里就简单写个h ...

  2. Nginx 高级配置-自定义json格式日志

    Nginx 高级配置-自定义json格式日志 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在大数据运维工作中,我们经常会使用flume,filebeat相关日志收集工具取收集日志 ...

  3. Nginx 核心配置-新建一个web站点

    Nginx 核心配置-新建一个web站点 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Nginx基础配置常用参数说明 [root@node101.yinzhengjie.or ...

  4. Nginx 核心配置-location的登录账户认证实战篇

    Nginx 核心配置-location的登录账户认证实战篇 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.使用ab命令模拟网站攻击 1>.安装httpd-tools工具 ...

  5. Nginx 核心配置-单节点实现多域名访问

    Nginx 核心配置-单节点实现多域名访问 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.试验环境说明 1>.虚拟机环境说明 [root@node101.yinzheng ...

  6. Nginx 核心配置详解

    目录 Nginx 核心配置详解 Nginx 四层访问控制: Nginx账户认证功能: 自定义错误页面: 自定义访问日志: 检测文件是否存在: 长连接配置: 作为下载服务器配置: 作为上传服务器: 其他 ...

  7. Nginx 核心配置-可优化配置参数

    Nginx 核心配置-可优化配置参数 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.nginx的官网查看指令帮助信息方法 1>.打开nginx的官网(https://ng ...

  8. Nginx 核心配置-作为上传服务器配置

    Nginx 核心配置-作为上传服务器配置 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.   一.关键参数说明 client_max_body_size 1m: 设置允许客户端上传单 ...

  9. Nginx 核心配置-作为下载服务器配置

    Nginx 核心配置-作为下载服务器配置 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.无限速版本的下载服务器 1>.查看主配置文件 [root@node101.yinz ...

随机推荐

  1. 关于==和equals的区别和联系,面试这么回答就可以

    长篇大论的话,我这里就不多写了,相信大家入门java 的时候就知道个大概了,这里想表述的是,如果面试官问你<关于==和equals的区别>,该怎么回答完美呢?可以这样说 总结的来说: 1) ...

  2. vijos2055 移动金币

    题目链接 思路 首先这是一个阶梯博弈. 我们将金币两两组合,如果对方移动前一个,那么我们把后一个移动相同的距离,局面相当于没有变化.如果对方移动后一个,就相当于\(NIM\)游戏中,取走了一些石子. ...

  3. echarts 中 柱图 、折线图、柱图层叠

    app.title = '折柱混合'; option = { tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: ...

  4. 推荐一款手机清理工具App悟空清理

    推荐一款手机清理工具App悟空清理 1 介绍 悟空清理是一款完全免费的手机加速与存储空间清理工具软件,强力去除顽固垃圾,使手机运行更畅快. 2 特色功能介绍 悟空在手,清理无忧!悟空清理,人人都在用的 ...

  5. etcd v3 ssl 集群添加新节点

    集群搭建 下面只用同一台服务器进行三个成员节点的开启 节点1 ./etcd --name cd0 --initial-advertise-peer-urls http://127.0.0.1:2380 ...

  6. js对数组去重的方法总结-(2019-1)

    最近待业在家,系统地学习了一套js的课程.虽然工作时间真的比较长了,但有些东西只局限在知其然而不知其所以然的程度上,有些知识点通过“血和泪”的经验积累下来,也只是记了结果并没有深究,所以每次听完课都有 ...

  7. mongodb集群化

    转自:https://www.cnblogs.com/nulige/p/7613721.html 一.mongodb主从复制配置 主从复制是MongoDB最常用的复制方式,也是一个简单的数据库同步备份 ...

  8. 提高性能,MySQL 读写分离环境搭建

    这是松哥之前一个零散的笔记,整理出来分享给大伙! MySQL 读写分离在互联网项目中应该算是一个非常常见的需求了.受困于 Linux 和 MySQL 版本问题,很多人经常会搭建失败,今天松哥就给大伙举 ...

  9. vue-如何实现带参数跳转页面

    [前后端分离项目之vue框架经验总结] 文/朱季谦 在vue框架的前端页面上,若要实现页面之间的带参数跳转,可参考以下实现过程: 例如,点击截图中的“查看试卷”,可实现带参跳转到相应的试卷页面,该功能 ...

  10. 排序算法Java代码实现(六)—— 堆排序

    本片内容: 堆排序 堆排序 最大堆: 二叉堆是完全二叉树或者是近似完全二叉树, 当父结点的键值总是大于或等于任何一个子节点的键值时为最大堆.(父节点大于任何一个子节点) 算法思想: 把n个元素建立最大 ...