基础版本
This commit is contained in:
22
parcels/roles/init/hbase/tasks/main.yml
Normal file
22
parcels/roles/init/hbase/tasks/main.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
- name: get HBase master_ip
|
||||
shell: echo "{{ ansible_play_hosts }}" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | head -n 1
|
||||
register: master_out
|
||||
|
||||
- name: master_ip to ansible variable
|
||||
set_fact: master_ip="{{master_out.stdout}}"
|
||||
|
||||
#复制tar到目标服务器
|
||||
- name: copy spark config files
|
||||
template:
|
||||
src: 'create-hbase-table.sh.j2'
|
||||
dest: '{{ install_path }}/{{ hbase_version }}/bin/create-hbase-table.sh'
|
||||
mode: 0755
|
||||
force: true
|
||||
backup: yes
|
||||
|
||||
- name: create hbase table
|
||||
shell: cd {{ install_path }}/{{ hbase_version }}/bin/ && ./create-hbase-table.sh
|
||||
run_once: true
|
||||
delegate_facts: true
|
||||
delegate_to: "{{ master_ip }}"
|
||||
|
||||
14
parcels/roles/init/hbase/templates/create-hbase-table.sh.j2
Normal file
14
parcels/roles/init/hbase/templates/create-hbase-table.sh.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/profile
|
||||
|
||||
exec {{ install_path }}/{{ hbase_version }}/bin/hbase shell <<EOF
|
||||
create_namespace 'tsg'
|
||||
create_namespace 'sub'
|
||||
|
||||
create 'tsg:report_result', {NAME => 'response', VERSIONS => 1,COMPRESSION => 'GZ',IS_MOB => true, MOB_THRESHOLD => 0}, {NAME => 'detail',COMPRESSION => 'GZ',VERSIONS => 1}
|
||||
|
||||
create 'sub:subscriber_info', {NAME => 'subscriber_id', VERSIONS => 1}
|
||||
|
||||
list
|
||||
EOF
|
||||
Reference in New Issue
Block a user