├── configuration ├── impala-ambari-config.xml └── impala-env.xml ├── .gitignore ├── README.md ├── package └── scripts │ ├── impala-daemon.py │ ├── impala-catalog.py │ ├── params.py │ └── impala-state-store.py └── metainfo.xml /configuration/impala-ambari-config.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .class 3 | .swp 4 | .idea 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #An Ambari Service for Impala 2 | 3 | 4 | ##To download the Impala service folder, run below 5 | 6 | 7 | ``` 8 | VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'` 9 | sudo git clone https://github.com/shuhuai007/ambari-impala-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/IMPALA 10 | ``` 11 | 12 | ##Restart Ambari 13 | \#sandbox 14 | service ambari restart 15 | 16 | \#non sandbox 17 | sudo service ambari-server restart -------------------------------------------------------------------------------- /configuration/impala-env.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | impala_log_dir 8 | /var/log/impala 9 | impala Log dir 10 | 11 | 12 | 13 | impala_user 14 | impala 15 | USER 16 | User impala catalog/state-store/daemon runs as 17 | 18 | 19 | 20 | impala_group 21 | impala 22 | GROUP 23 | impala group 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /package/scripts/impala-daemon.py: -------------------------------------------------------------------------------- 1 | import sys, os, pwd, signal, time 2 | from resource_management import * 3 | from resource_management.core.base import Fail 4 | from resource_management.core.exceptions import ComponentIsNotRunning 5 | from subprocess import call 6 | 7 | 8 | class ImpalaDaemon(Script): 9 | #Call setup.sh to install the service 10 | def install(self, env): 11 | 12 | # Install packages listed in metainfo.xml 13 | self.install_packages(env) 14 | 15 | cmd = 'yum-config-manager --add-repo ' \ 16 | 'http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/cloudera-cdh5.repo' 17 | 18 | Execute('echo "Running ' + cmd + '"') 19 | Execute(cmd) 20 | 21 | 22 | cmd = 'yum -y install impala-server impala-catalog impala-state-store impala-shell' 23 | Execute('echo "Running ' + cmd + '"') 24 | Execute(cmd) 25 | 26 | self.configure(env) 27 | 28 | def configure(self, env): 29 | import params 30 | 31 | env.set_params(params) 32 | 33 | 34 | #Call start.sh to start the service 35 | def start(self, env): 36 | cmd = 'service impala-server start' 37 | Execute('echo "Running cmd: ' + cmd + '"') 38 | Execute(cmd) 39 | 40 | #Called to stop the service using the pidfile 41 | def stop(self, env): 42 | cmd = 'service impala-server stop' 43 | Execute('echo "Running cmd: ' + cmd + '"') 44 | Execute(cmd) 45 | 46 | #Called to get status of the service using the pidfile 47 | def status(self, env): 48 | cmd = 'service impala-server status' 49 | Execute('echo "Running cmd: ' + cmd + '"') 50 | Execute(cmd) 51 | 52 | if __name__ == "__main__": 53 | ImpalaDaemon().execute() -------------------------------------------------------------------------------- /package/scripts/impala-catalog.py: -------------------------------------------------------------------------------- 1 | import sys, os, pwd, signal, time 2 | from resource_management import * 3 | from resource_management.core.base import Fail 4 | from resource_management.core.exceptions import ComponentIsNotRunning 5 | from subprocess import call 6 | 7 | 8 | class ImpalaCatalog(Script): 9 | #Call setup.sh to install the service 10 | def install(self, env): 11 | 12 | # Install packages listed in metainfo.xml 13 | self.install_packages(env) 14 | 15 | cmd = 'yum-config-manager --add-repo ' \ 16 | 'http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/cloudera-cdh5.repo' 17 | 18 | Execute('echo "Running ' + cmd + '"') 19 | Execute(cmd) 20 | 21 | 22 | cmd = 'yum -y install impala-server impala-catalog impala-state-store impala-shell' 23 | Execute('echo "Running ' + cmd + '"') 24 | Execute(cmd) 25 | 26 | self.configure(env) 27 | 28 | def configure(self, env): 29 | import params 30 | 31 | env.set_params(params) 32 | 33 | 34 | #Call start.sh to start the service 35 | def start(self, env): 36 | cmd = 'service impala-catalog start' 37 | Execute('echo "Running cmd: ' + cmd + '"') 38 | Execute(cmd) 39 | 40 | #Called to stop the service using the pidfile 41 | def stop(self, env): 42 | cmd = 'service impala-catalog stop' 43 | Execute('echo "Running cmd: ' + cmd + '"') 44 | Execute(cmd) 45 | 46 | #Called to get status of the service using the pidfile 47 | def status(self, env): 48 | cmd = 'service impala-catalog status' 49 | Execute('echo "Running cmd: ' + cmd + '"') 50 | Execute(cmd) 51 | 52 | if __name__ == "__main__": 53 | ImpalaCatalog().execute() 54 | -------------------------------------------------------------------------------- /package/scripts/params.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from resource_management import * 3 | from resource_management.libraries.script.script import Script 4 | import sys, os, glob 5 | from resource_management.libraries.functions.version import format_hdp_stack_version 6 | from resource_management.libraries.functions.default import default 7 | 8 | 9 | 10 | # server configurations 11 | config = Script.get_config() 12 | 13 | 14 | 15 | # # params from flink-ambari-config 16 | # flink_install_dir = config['configurations']['flink-ambari-config']['flink_install_dir'] 17 | # flink_numcontainers = config['configurations']['flink-ambari-config']['flink_numcontainers'] 18 | # flink_jobmanager_memory = config['configurations']['flink-ambari-config']['flink_jobmanager_memory'] 19 | # flink_container_memory = config['configurations']['flink-ambari-config']['flink_container_memory'] 20 | # setup_prebuilt = config['configurations']['flink-ambari-config']['setup_prebuilt'] 21 | # flink_appname = config['configurations']['flink-ambari-config']['flink_appname'] 22 | # flink_queue = config['configurations']['flink-ambari-config']['flink_queue'] 23 | # flink_streaming = config['configurations']['flink-ambari-config']['flink_streaming'] 24 | # 25 | # hadoop_conf_dir = config['configurations']['flink-ambari-config']['hadoop_conf_dir'] 26 | # flink_download_url = config['configurations']['flink-ambari-config']['flink_download_url'] 27 | # 28 | # 29 | # conf_dir='' 30 | # bin_dir='' 31 | 32 | # params from flink-conf.yaml 33 | impala_user = config['configurations']['impala-env']['impala_user'] 34 | impala_group = config['configurations']['impala-env']['impala_group'] 35 | impala_log_dir = config['configurations']['impala-env']['impala_log_dir'] 36 | impala_log_file = os.path.join(impala_log_dir,'impala-setup.log') -------------------------------------------------------------------------------- /package/scripts/impala-state-store.py: -------------------------------------------------------------------------------- 1 | import sys, os, pwd, signal, time 2 | from resource_management import * 3 | from resource_management.core.base import Fail 4 | from resource_management.core.exceptions import ComponentIsNotRunning 5 | from subprocess import call 6 | 7 | 8 | class StateStore(Script): 9 | #Call setup.sh to install the service 10 | def install(self, env): 11 | 12 | # Install packages listed in metainfo.xml 13 | self.install_packages(env) 14 | 15 | cmd = 'yum-config-manager --add-repo ' \ 16 | 'http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/cloudera-cdh5.repo' 17 | 18 | Execute('echo "Running ' + cmd + '"') 19 | Execute(cmd) 20 | 21 | cmd = 'yum -y install impala-server impala-catalog impala-state-store impala-shell' 22 | Execute('echo "Running ' + cmd + '"') 23 | Execute(cmd) 24 | 25 | self.configure(env) 26 | 27 | def configure(self, env): 28 | import params 29 | 30 | env.set_params(params) 31 | 32 | 33 | #Call start.sh to start the service 34 | def start(self, env): 35 | import params 36 | self.configure(env) 37 | 38 | self.create_hdfs_user(params.flink_user) 39 | cmd = 'service impala-state-store start' 40 | Execute('echo "Running cmd: ' + cmd + '"') 41 | Execute(cmd) 42 | 43 | #Called to stop the service using the pidfile 44 | def stop(self, env): 45 | cmd = 'service impala-state-store stop' 46 | Execute('echo "Running cmd: ' + cmd + '"') 47 | Execute(cmd) 48 | 49 | #Called to get status of the service using the pidfile 50 | def status(self, env): 51 | cmd = 'service impala-state-store status' 52 | Execute('echo "Running cmd: ' + cmd + '"') 53 | Execute(cmd) 54 | 55 | def create_hdfs_user(self, user): 56 | Execute('hadoop fs -mkdir -p /user/'+user, user='hdfs', ignore_failures=True) 57 | Execute('hadoop fs -chown ' + user + ' /user/'+user, user='hdfs') 58 | Execute('hadoop fs -chgrp ' + user + ' /user/'+user, user='hdfs') 59 | 60 | if __name__ == "__main__": 61 | StateStore().execute() -------------------------------------------------------------------------------- /metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 5 | 6 | IMPALA 7 | Impala 8 | impala config 9 | 0.10.0 10 | 11 | 12 | IMPALA_STATE_STORE 13 | Impala_State_Store 14 | MASTER 15 | 1 16 | 17 | 18 | PYTHON 19 | 10000 20 | 21 | 22 | 23 | 24 | IMPALA_CATALOG_SERVICE 25 | Impala_Catalog_Service 26 | MASTER 27 | 1 28 | 29 | 30 | PYTHON 31 | 10000 32 | 33 | 34 | 35 | 36 | IMPALA_DAEMON 37 | Impala_Daemon 38 | SLAVE 39 | 1 40 | 41 | 42 | PYTHON 43 | 10000 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | redhat6 52 | 53 | git 54 | apache-maven-3.2* 55 | 56 | 57 | 58 | 59 | 60 | impala-ambari-config 61 | 62 | 63 | 64 | 65 | --------------------------------------------------------------------------------