项目作者: ownport

项目描述 :
Deployment for DataStax Cassandra
高级语言: Python
项目地址: git://github.com/ownport/datastax-cassandra-deploy.git
创建时间: 2019-06-11T05:18:14Z
项目社区:https://github.com/ownport/datastax-cassandra-deploy

开源协议:Apache License 2.0

下载


Datastax Cassandra Deployment

The main idea of this project is apply Infrasrtucture As Code approach for DataStax Cassandra. Inspired by:

Disclaimer

The software is under development and not finalized yet. The use of this repo is intended for development purpose only. Usage of this repo is solely at user’s own risks.

Licence

These scripts use DataStax Enterprise. By using these scripts the user accepts the licensing terms set forth here: http://www.datastax.com/enterprise-terms

How to install

  1. pip3 install git+https://github.com/ownport/datastax-cassandra-deploy

How to use

  1. ds-cas-deploy --help
  2. usage: ds-cas-deploy [-h] [-v] [-l LOG_LEVEL] [-a ACTION] [-s SECTION]
  3. [-o OUTPUT] [-d DEPLOYMENT]
  4. optional arguments:
  5. -h, --help show this help message and exit
  6. -v, --version show program's version number and exit
  7. -l LOG_LEVEL, --log-level LOG_LEVEL
  8. Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL
  9. -a ACTION, --action ACTION
  10. Actions: deploy | dump
  11. -s SECTION, --section SECTION
  12. The section for config dump. Possible values:
  13. credentials, config-profiles, datacenters,
  14. repositories, clusters
  15. -o OUTPUT, --output OUTPUT
  16. The output path for config dump, JSON file
  17. -d DEPLOYMENT, --deployment DEPLOYMENT
  18. the path to deployment configuration. Support
  19. YAML/JSON file

To run deployment

  1. ds-cas-deploy \
  2. --action deploy \
  3. --deployment test/resources/configs/test-env/opscenter.yaml \
  4. --deployment test/resources/configs/test-env/credentials.yaml \
  5. --deployment test/resources/configs/test-env/config-profiles.yaml \
  6. --deployment test/resources/configs/test-env/repositories.yaml \
  7. --deployment test/resources/configs/test-env/test-cluster.yaml

To dump data from OpsCenter

  1. ds-cas-deploy \
  2. --action dump \
  3. --section credentials \
  4. --section config-profiles \
  5. --section datacenters \
  6. --section repositories \
  7. --output test/resources/configs/test-env/opscenter-dump.json \
  8. --deployment test/resources/configs/test-env/opscenter.yaml

Deployment configs (sample)

Only opscenter section is mandatory. It is required for connection to DataStax OpsCenter. The rest sections are optional:

  • credentials
  • repositories
  • config-profiles
  • datacenters
  • clusters

For instance, if credentials, repositories or config profiles were created before there are no need to specify them again

opscenter.yaml

  1. opscenter:
  2. hostname: 172.19.0.3
  3. username: admin
  4. password: admin
  5. timeout: 25
  6. attempts: 3

credentials.yaml

  1. credentials:
  2. - name: test-ssh-creds
  3. become-mode: sudo
  4. use-ssh-keys: true
  5. login-user: cassandra
  6. login-password: null
  7. ssh-private-key: test/resources/keys/cassandra
  8. ssh-unlock: null
  9. become-user: null
  10. become-password: null

repositories.yaml

  1. repositories:
  2. - name: test-repository
  3. repo-key-url: null
  4. repo-url: null
  5. username: test
  6. password: test
  7. use-proxy: false
  8. deb-dist: null
  9. deb-components: null,
  10. manual-repository-setup: true
  11. comment: Test DataStax Repository

config-profiles.yaml

  1. config-profiles:
  2. - name: test-profile-v673
  3. datastax-version: 6.7.3
  4. json:
  5. cassandra-yaml:
  6. authenticator: com.datastax.bdp.cassandra.auth.DseAuthenticator
  7. num_tokens: 256
  8. allocate_tokens_for_local_replication_factor: 2
  9. endpoint_snitch: org.apache.cassandra.locator.GossipingPropertyFileSnitch
  10. dse-yaml:
  11. authorization_options:
  12. enabled: true
  13. authentication_options:
  14. enabled: true
  15. dsefs_options:
  16. enabled: true

datacenters.yaml

  1. datacenters:
  2. - name: test-datacenter

test-cluster.yaml

  1. clusters:
  2. - name: test-cassandra-cluster
  3. comment: Test Cassandra Cluster
  4. repository-id: test-repository
  5. config-profile-id: test-profile-v673
  6. ssh-management-port: 22
  7. managed: true
  8. datacenter: test-datacenter
  9. nodes:
  10. - name: test-cluster-node-01
  11. ssh-management-address: 172.19.0.4
  12. seed: true
  13. - name: test-cluster-node-02
  14. ssh-management-address: 172.19.0.5
  15. seed: true
  16. - name: test-cluster-node-03
  17. ssh-management-address: 172.19.0.2
  18. seed: true