Skip to content

Instantly share code, notes, and snippets.

View harryge00's full-sized avatar

Haoyuan Ge harryge00

  • Ant Financial
  • Hangzhou
View GitHub Profile

使用腾讯云备份Cassandra

2.5.0-3.11.3版本开始,dcos cassandra 兼容S3协议对象存储的备份,腾讯云的的对象存储cos兼容AWS S3协议,所以针对s3的脚本也可以应用于腾讯云。

备份 Cassandra 数据

以腾讯云上海地区的存储(cos.ap-shanghai.myqcloud.com)为例,执行如下命令,cassandra的数据将被备份:

export AWS_ACCESS_KEY_ID=#{腾讯云的KEY_ID}	
export AWS_SECRET_ACCESS_KEY=#{腾讯云的secret_key}
export S3_BUCKET_NAME=#{腾讯云cos桶名}
dcos cassandra plan start backup-s3 \
@harryge00
harryge00 / rabbitmq.conf
Created October 14, 2019 16:28
rabbitmq config file
loopback_users.guest = false
total_memory_available_override_value = 1107296256
listeners.tcp.default = 5672
default_pass = password
default_user = admin
management.tcp.port = 15672
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.0 = testrabbitmq3.autoip.dcos.thisdcos.directory
@harryge00
harryge00 / svc.yml
Created September 6, 2019 01:50
mongodb svc
name: {{FRAMEWORK_NAME}}
scheduler:
principal: {{FRAMEWORK_PRINCIPAL}}
user: {{FRAMEWORK_USER}}
pods:
mongorep:
count: 3
image: {{MONGO_IMAGE}}
placement: '{{{NODE_PLACEMENT}}}'
@harryge00
harryge00 / redis.conf
Created August 31, 2019 11:35
redis.conf redis cluster
cluster-enabled yes
cluster-require-full-coverage no
cluster-node-timeout 15000
cluster-config-file /data/nodes.conf
cluster-migration-barrier 1
appendonly yes
protected-mode no
@harryge00
harryge00 / update-node.sh
Created August 31, 2019 11:33
redis cluster update-node.sh
#!/bin/sh
REDIS_NODES="/data/nodes.conf"
sed -i -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${HOST}/" ${REDIS_NODES}
exec "$@"
@harryge00
harryge00 / backup.sh
Created July 29, 2019 01:33
cassandra backup
if [ -z $JMX_PORT ]; then
export JMX_PORT=7199
echo "set JMX_PORT to default value: $JMX_PORT"
fi
if [ -d python-dist ]; then
export PATH=$MESOS_SANDBOX/python-dist/bin:$PATH ;
fi
echo "hello, remote user!"
sleep 10
echo "hello, remote user!"
@harryge00
harryge00 / mesos-framework.md
Created July 19, 2019 05:59
teardown mesos framework
@harryge00
harryge00 / mesos-container.md
Last active June 25, 2019 08:29
mesos container

mesos-container

为了能使用 mesos-container, 需要在 mesos-slave 配置isolation, image_providers, containerizers 等: 一种办法是在 /etc/default/mesos-slave 中添加如下内容:

MESOS_IMAGE_PROVIDERS=docker
MESOS_CONTAINERIZERS=docker,mesos
MESOS_ISOLATION=cgroups/cpu,cgroups/mem,cgroups/devices,cgroups/pids,cgroups/blkio,disk/du,network/cni,filesystem/linux,docker/runtime,volume/sandbox_path,volume/secret,posix/rlimits,namespaces/pid,linux/capabilities

也可以在 /etc/mesos-slave 目录下单独添加

@harryge00
harryge00 / mesos-CLI.md
Last active July 15, 2019 09:50
mesos client cli exec

Mesos-CLI agent插件说明

为了支持直接和 mesos-agent 交互,并执行 exec/list/attach 这些命令,在 src/python/cli_new 中添加了新的插件 agent-container。 命令用法如下:

# mesos agent-container list
Container ID                          Executor ID                                                Framework ID                                 
89bf1287-c1d9-495d-97e7-654fb5258009  nginx.e37ad665-9df4-11e9-8529-a620e9d3bf81                 961adbe5-65e7-4bdf-a6c8-acf7540dc6b2-0000  
2830ea3d-b974-4774-8f44-cc3abef3c13d  testucr.9ed70b92-9db7-11e9-8529-a620e9d3bf81               961adbe5-65e7-4bdf-a6c8-acf7540dc6b2-0000