Yongtao's Blog

坚守 无畏 宽容 进取


  • 首页

  • 归档

  • 搜索

生产环境下的Elasticsearch参数调整

发表于 2019-06-28 | 更新于 2019-06-28 | 分类于 elasticsearch | 阅读次数

开启config/elasticsearch.yml中network.host配置后,ES启动时会切换为生产模式,开发模式下的警告会升级为异常,导致ES节点无法启动。

禁止swapping

设置Elasticsearch可锁定的、不被交换出的内存不受限制。编辑config/elasticsearch.yml

1
2
# 设置为true
bootstrap.memory_lock: true

编辑/etc/security/limits.conf文件,追加下述配置:

1
2
# elasticsearch用户锁定内存(不会被swap)不受限制
elasticsearch - memlock unlimited

阅读全文 »

Docker swarm删除节点

发表于 2019-05-15 | 更新于 2019-05-15 | 分类于 docker | 阅读次数

Docker swarm删除节点

1
2
3
4
5
6
7
8
9
10
11
# 在管理节点上先排空节点
docker node update --availability drain yyxh5zbei71kq7c5tadoq19ri
# 移除节点
docker node rm yyxh5zbei71kq7c5tadoq19ri
# 或者强制删除
docker node rm --force yyxh5zbei71kq7c5tadoq19ri

# 在所要删除的节点上执行
docker swarm leave
# 或强制离开
docker swarm leave --force

网络IO之同步、异步 & 阻塞、非阻塞

发表于 2019-03-08 | 更新于 2019-03-08 | 阅读次数

同步(Synchronous)

A synchronous I/O operation causes the requesting process to be blocked until that I/O operation completes; (同步I/O操作导致请求进程被阻塞,直到I/O操作完成)

异步(Asynchronous)

An asynchronous I/O operation does not cause the requesting process to be blocked; (异步I/O操作不会阻塞请求进程)

注意Non-blocking IO在执行recvfrom这个系统调用的时候,如果kernel的数据没有准备好,不会block进程;如果kernel数据准备好了,recvfrom会将数据从内核空间拷贝到用户空间,在这段时间内,进程还是被block的。

阻塞(Blocking)

阻塞调用是指调用结果返回之前,当前线程会被挂起。

非阻塞(Non-blocking)

非阻塞调用指在不能立刻得到结果之前,该调用不会阻塞当前线程。

http://www.rowkey.me/blog/2016/01/18/io-model/
https://baiweiblog.wordpress.com/tag/non-blocking/
https://www.zhihu.com/question/19732473/answer/20851256
https://blog.csdn.net/historyasamirror/article/details/5778378

Git版本回退

发表于 2019-03-04 | 更新于 2019-03-04 | 阅读次数

改动未提交至远程仓库的情况

1
2
# 将HEAD指向commit_id
[root@localhost ~]# git reset --hard commit_id

改动已提交至远程仓库的情况

1
2
3
# revert是放弃指定提交的修改,会生成一次新的提交,需要填写注释,历史记录都在;而reset是指将HEAD指针指到指定提交;
[root@localhost ~]# git revert HEAD
[root@localhost ~]# git push origin master
阅读全文 »

Docker Swarm节点维护标签

发表于 2018-10-30 | 更新于 2018-10-30 | 分类于 docker | 阅读次数

Swarm节点维护标签

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@docker_001 ~]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
lw72u2jd7xi1xagw94cmd86kk * docker_001 Ready Active Leader 18.06.1-ce
2igmbyfampcduad32ustl00y8 docker_003 Ready Active 18.06.1-ce
wudald9nltt9mq9jo9aau3tvf docker_005 Ready Active 18.06.1-ce

# 增加一个type=dop的标签
[root@docker_001 ~]# docker node update --label-add type=dop lw72u2jd7xi1xagw94cmd86kk
lw72u2jd7xi1xagw94cmd86kk

# 查看标签
[root@docker_001 ~]# docker node inspect lw72u2jd7xi1xagw94cmd86kk --pretty
ID: lw72u2jd7xi1xagw94cmd86kk
Labels:
- type=dop
Hostname: docker_001
Joined at: 2018-10-24 13:52:32.919572847 +0000 utc
...

# 移除标签
[root@docker_001 ~]# docker node update --label-rm type lw72u2jd7xi1xagw94cmd86kk
lw72u2jd7xi1xagw94cmd86kk
[root@docker_001 ~]# docker node inspect lw72u2jd7xi1xagw94cmd86kk --pretty
ID: lw72u2jd7xi1xagw94cmd86kk
Hostname: docker_001
Joined at: 2018-10-24 13:52:32.919572847 +0000 utc

Add-or-remove-label-metadata

1…567…12
wangyt

wangyt

白日不到处,青春恰自来
苔花如米小,也学牡丹开

58 日志
29 分类
45 标签
RSS
GitHub 微博
Creative Commons
  • How2j
  • 寒泉子
  • 朱双印
© 2016 - 2023 wangyt