Skip to content

mediapeers/ansible-role-clickhouse

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Ansible Clickhouse role

Simple clickhouse-server deploy and management role. For ubuntu or debian server.

This is a fork of https://github.com/AlexeySetevoi/ansible-clickhouse

Role Variables

Most variables have sane defaults. However you can overwrite them in defaults/main.yml.

You can manage listen ports

clickhouse_http_port: 8123
clickhouse_tcp_port: 9000
clickhouse_interserver_http: 9009

you can manage listen ip:

clickhouse_listen_hosts:
  - "192.168.0.1"

You can create custom profiles

clickhouse_profiles:
 my_custom_profile:
   max_memory_usage: 10000000000
   use_uncompressed_cache: 0
   load_balancing: random
   my_super_param: 9000

You can set-up users like this:

clickhouse_users:
      - { name: "testuser",
          password_sha256_hex: "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2",
          networks: "{{ clickhouse_networks_default }}",
          profile: "default",
          quota: "default",
          dbs: [ testu1 ] ,
          comment: "classic user with plain password"}
      - { name: "testuser2",
          password: "testplpassword",
          networks: "{{ clickhouse_networks_default }}",
          profile: "default",
          quota: "default",
          dbs: [ testu2 ] ,
          comment: "classic user with hex password"}
      - { name: "testuser3",
          password: "testplpassword",
          networks: { 192.168.0.0/24, 10.0.0.0/8 },
          profile: "default",
          quota: "default",
          dbs: [ testu1,testu2,testu3 ] ,
          comment: "classic user with multi dbs and multi-custom network allow password"}

You can manage own quotas:

clickhouse_quotas:
 - { name: "my_custom_quota", intervals: "{{ clickhouse_quotas_intervals_default }}",comment: "Default quota - count only" }

Quote object is simple dict:

 - { duration: 3600, queries: 0, errors: 0,result_rows: 0,read_rows: 0,execution_time: 0 }

F: You can create any databases: default db state - present

clickhouse_dbs:
      - { name: testu1 }
      - { name: testu2 }
      - { name: testu3 }
      - { name: testu4, state: absent }
      - { name: testu4, state: present }

You can create dictionary via odbc

clickhouse_dicts:
          test1:
            name: test_dict
            odbc_source:
              connection_string: "DSN=testdb"
              source_table: "dict_source"
            lifetime:
              min: 300
              max: 360
            layout: hashed
            structure:
              key: "testIntKey"
              attributes:
                - { name: testAttrName, type: UInt32, null_value: 0 }
          test2:
            name: test_dict
            odbc_source:
              connection_string: "DSN=testdb"
              source_table: "dict_source"
            lifetime:
              min: 300
              max: 360
            layout: complex_key_hashed
            structure:
              key:
                attributes:
                  - { name: testAttrComplexName, type: String }
              attributes:
                - { name: testAttrName, type: String, null_value: "" }

Alternatively you can also provide your own file containing dicts using the clickhouse_dict_file: path/to/file.xml paremeter.

Example Playbook

Example playbook setting up Clickhouse server with a custom data dir and to be accessible in a IPv4 network. Relying on the default setting for the rest.

  - hosts: localhost
    become: true
    vars:
      clickhouse_path_data: /data/clickhouse/
      clickhouse_http_port: 8123
      clickhouse_allowed_networks:
        - 10.10.0.0/16
      clickouse_listen_hosts:
        - 0.0.0.0
    roles:
      - ansible-clickhouse

License

BSD

Author Information

ClickHouse by Yandex LLC.

Role by AlexeySetevoi.

Dear contributors, thank you.

About

Ansible Role - Installs and configures clickhouse

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%