forked from HortonworksUniversity/Security_Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
89 lines (73 loc) · 2.71 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set -o xtrace
export HOME=${HOME:-/root}
export TERM=xterm
export ambari_pass=${ambari_pass:-BadPass#1}
export ambari_server_custom_script=${ambari_server_custom_script:-~/ambari-bootstrap/ambari-extras.sh}
cd
yum makecache
yum -y -q install git epel-release ntpd screen mysql-connector-java jq python-argparse python-configobj
el_version=$(sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release | cut -d. -f1)
case ${el_version} in
"6")
sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo || true
;;
"7")
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
;;
esac
curl -sSL https://raw.githubusercontent.com/HortonworksUniversity/ambari-bootstrap/master/extras/deploy/install-ambari-bootstrap.sh | bash
~/ambari-bootstrap/ambari-bootstrap.sh
## Ambari Server specific tasks
if [ "${install_ambari_server}" = "true" ]; then
bash -c "nohup ambari-server start" || true
sleep 60
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
ambari_pass=admin source ~/ambari-bootstrap/extras/ambari_functions.sh
ambari-change-pass admin admin ${ambari_pass}
if [ "${deploy}" = "true" ]; then
cd ~/ambari-bootstrap/deploy
## various configuration changes for demo environments, and fixes to defaults
cat << EOF > configuration-custom.json
{
"configurations" : {
"yarn-site": {
"yarn.scheduler.minimum-allocation-vcores": "1",
"yarn.scheduler.maximum-allocation-vcores": "1",
"yarn.scheduler.minimum-allocation-mb": "256",
"yarn.scheduler.maximum-allocation-mb": "2048"
},
"hive-site": {
"hive.support.concurrency": "true",
"hive.enforce.bucketing": "true",
"hive.exec.dynamic.partition.mode": "nonstrict",
"hive.txn.manager": "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager",
"hive.compactor.initiator.on": "true",
"hive.compactor.worker.threads": "1"
},
"solr-env": {
"solr.port": "6083"
},
"solr-config": {
"solr.port": "6083",
"solr.datadir": "/opt/ranger_audit_server",
"solr.download.location": "HDPSEARCH",
"solr.znode": "/ranger_audits",
"solr.cloudmode": "true"
}
}
}
EOF
export ambari_services="${ambari_services:-"HDFS MAPREDUCE2 PIG YARN HIVE ZOOKEEPER AMBARI_METRICS"}"
export ambari_password="${ambari_pass}"
export cluster_name=${stack:-mycluster}
export host_count=${host_count:-skip}
./deploy-recommended-cluster.bash
cd ~
sleep 5
source ~/ambari-bootstrap/extras/ambari_functions.sh
ambari-configs
ambari_wait_request_complete 1
fi
fi
exit 0