- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat .gitmodules | grep 'url =' | awk -F ' = ' '{print $2}' | awk -F'/' '{print "git submodule add " $1 "/" $2 " repos/" substr($2, 0, index($2, ".") - 1) }' |
To remove a submodule you need to:
- Delete the relevant section from the .gitmodules file.
- Stage the .gitmodules changes git add .gitmodules
- Delete the relevant section from .git/config.
- Run git rm --cached path_to_submodule (no trailing slash).
- Run rm -rf .git/modules/path_to_submodule (no trailing slash).
- Commit git commit -m "Removed submodule "
- Delete the now untracked submodule files rm -rf path_to_submodule
zookeeper 与 kafka 集群设置教程, 作为教程, 下文描述的步骤是在 1台 服务器上部署 启动三个 zookeeper 和 kafka 服务以组成模拟集群, 多机上的注意事项会在相关位置说明
FIXME
的均为在实际环境中需要注意的值(比如 ip, 端口, 文件路径), 其余值新增内容均为固定值
mkdir -p /data/kafka-cluster-test/{kafka,zookeeper}-data-{1,2,3}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AAAv1BBBv2BBBCCCv3CCCDDDv4DDDAAA | |
0 5 10 13 18 21 26 29 | |
0 2 4 4 6 6 8 8 | |
rep AAA | |
0 2 7 10 15 18 23 26 | |
rep AAA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf8 -*- | |
""" | |
Author : Myth | |
Date : 2018/5/9 | |
Email : email4myth at gmail.com | |
""" | |
import json | |
import os | |
import signal |
#0 EventMgr::QueueEvent (this=0xc312c0 <mgr>, event=event@entry=0x7fffd806eaf0) at /root/myth/bro-2.5.1/src/Event.cc:90
#1 0x00000000005fe6b7 in QueueEvent (obj=0x0, mgr=0x0, aid=0, src=0, vl=0x7fffd8069840, h=..., this=<optimized out>) at /root/myth/bro-2.5.1/src/Event.h:88
#2 Reporter::DoLog (this=0xc92a10, prefix=prefix@entry=0x908d37 "error", event=..., out=0x7ffff640d1c0 <_IO_2_1_stderr_>, conn=conn@entry=0x0,
addl=addl@entry=0x0, location=location@entry=true, time=time@entry=true, postfix=postfix@entry=0x0,
fmt=fmt@entry=0x7ffff482bd70 "Kafka send failed: %s", ap=ap@entry=0x7fffe318eaf8) at /root/myth/bro-2.5.1/src/Reporter.cc:350
#3 0x00000000005fee9f in Reporter::Error (this=<optimized out>, fmt=fmt@entry=0x7ffff482bd70 "Kafka send failed: %s")
at /root/myth/bro-2.5.1/src/Reporter.cc:76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.contrib.project import rsync_project as _rsync_project | |
import tempfile | |
import os | |
def rsync_project(*args, **kwargs): | |
temp_pri_key = tempfile.mktemp(prefix='prs-rsa-') | |
temp_pub_key = temp_pri_key + '.pub' | |
local('ssh-keygen -t rsa -b 2048 -C "rsync-project@fabric" -N "" -f "%s"' % temp_pri_key) | |
run("mkdir -p /root/.ssh") | |
put(File(open(temp_pub_key).read(), "tmp-id_rsa.pub"), '/root/.ssh/authorized_keys') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf8 -*- | |
""" | |
Author : Myth | |
Date : 18/1/11 | |
Email : email4myth at gmail.com | |
""" | |
import email | |
import email.header | |
import hashlib |
grep --include "*.bro" -r -e "register_for_ports" * | grep register_for_ports | grep -v call | grep "::ANALYZER_" | awk -F 'ANALYZER_' '{print $2}' | awk -F ',' '{print $1}' | sort
# results 27. bro-2.5.1
AYIYA
DCE_RPC
DHCP
DNP3_TCP