Skip to content

Instantly share code, notes, and snippets.

@ScottEvil
Last active August 29, 2015 14:23
Show Gist options
  • Save ScottEvil/86a4d5cdca0ae48298bf to your computer and use it in GitHub Desktop.
Save ScottEvil/86a4d5cdca0ae48298bf to your computer and use it in GitHub Desktop.
Automated install and config for GeoWave on Hortonworks 2.3 Sandbox from mailing list post by aspohn
#!/bin/bash
#
# Install GeoWave on Hortonworks Sandbox VM using RPMs and Puppet
# Puppet client is already installed, add Puppet standard libs, configure GeoWave repo and install
#
# Assumptions:
# - You have a working Internet connection
# - Your Accumulo root user account password has been set to hadoop
# - When prompted to set the geowave you will set the password to geowave
#
echo -e "\nStep 1 of 5: Installing GeoWave\n---------------------------------------\n"
rpm -Uvh http://s3.amazonaws.com/geowave-rpms/release/noarch/geowave-repo-1.0-3.noarch.rpm
yum -y --enablerepo=geowave install geowave-puppet
puppet module install puppetlabs-stdlib
# I use port 8993 as it's already configured in the VM port forwarding and not used by default
# If you decide to use the solr service you'll have to pick a new unused port
cat << EOF > /tmp/geowave.pp
class { 'geowave::repo': repo_enabled => 1, } ->
class { 'geowave':
geowave_version => '0.8.7',
hadoop_vendor_version => 'hdp2',
install_accumulo => true,
install_app => true,
install_app_server => true,
http_port => '8993',
}
EOF
puppet apply /tmp/geowave.pp
# Configure Accumulo - You will be prompted to create a password for the geowave user. I suggest geowave as the password
# Manual Steps Documentation: http://ngageoint.github.io/geowave/documentation.html#accumulo-configuration
echo -e "\nStep 2 of 5: Configuring Accumulo\n---------------------------------------\n"
cat << EOF > /tmp/accumulo-commands
createuser geowave
createnamespace geowave
grant NameSpace.CREATE_TABLE -ns geowave -u geowave
config -s general.vfs.context.classpath.geowave=hdfs://sandbox.hortonworks.com:8020/apps/accumulo/classpath/geowave/0.8.7-hdp2/[^.].*.jar
config -ns geowave -s table.classpath.context=geowave
exit
EOF
# This is assuming you set admin as the password of the root user when you configured the Accumulo service
accumulo shell -u root -p 'pass:hadoop' -fv /tmp/accumulo-commands
# Download a small data file and ingest
echo -e "\nStep 3 of 5: Ingesting Sample Data\n---------------------------------------\n"
curl http://naciscdn.org/naturalearth/50m/cultural/ne_50m_admin_0_countries.zip > /tmp/ne_50m_admin_0_countries.zip
mkdir /tmp/ingest; unzip -d /tmp/ingest/ /tmp/ne_50m_admin_0_countries.zip
geowave -localingest -b /tmp/ingest -i hdp-accumulo-instance -n geowave.50m_admin_0_countries -f geotools-vector -u geowave -p geowave -z sandbox.hortonworks.com:2181
# Configure GeoServer
echo -e "\nStep 4 of 5: Configuring GeoServer\n---------------------------------------\n"
cat << EOF > /tmp/geowave-datastore.xml
<dataStore>
<name>geowave.50m_admin_0_countries</name>
<type>GeoWave Datastore</type>
<connectionParameters>
<entry key="ZookeeperServers">sandbox.hortonworks.com:2181</entry>
<entry key="Password">geowave</entry>
<entry key="Namespace">geowave.50m_admin_0_countries</entry>
<entry key="UserName">geowave</entry>
<entry key="Authorization Management Provider">empty</entry>
<entry key="Lock Management">memory</entry>
<entry key="InstanceName">hdp-accumulo-instance</entry>
</connectionParameters>
</dataStore>
EOF
curl -u admin:geoserver -XPOST -T /tmp/geowave-datastore.xml -H "Content-type: text/xml" http://localhost:8993/geoserver/rest/workspaces/geowave/datastores
cat << EOF > /tmp/ne_50m_admin_0_countries-layer.xml
<featureType>
<name>ne_50m_admin_0_countries</name>
<nativeCRS>GEOGCS[&quot;WGS 84&quot;,
DATUM[&quot;World Geodetic System 1984&quot;,
SPHEROID[&quot;WGS 84&quot;, 6378137.0, 298.257223563, AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],
AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],
PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],
UNIT[&quot;degree&quot;, 0.017453292519943295],
AXIS[&quot;Geodetic longitude&quot;, EAST],
AXIS[&quot;Geodetic latitude&quot;, NORTH],
AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</nativeCRS>
<srs>EPSG:4326</srs>
<nativeBoundingBox>
<minx>-180.0</minx>
<maxx>180.0</maxx>
<miny>-90.0</miny>
<maxy>90.0</maxy>
<crs>EPSG:4326</crs>
</nativeBoundingBox>
<projectionPolicy>FORCE_DECLARED</projectionPolicy>
</featureType>
EOF
curl -u admin:geoserver -XPOST -T /tmp/ne_50m_admin_0_countries-layer.xml -H "Content-type: text/xml" http://localhost:8993/geoserver/rest/workspaces/geowave/datastores/geowave.50m_admin_0_countries/featuretypes
echo -e "\nStep 5 of 5: Layer Preview\n---------------------------------------\n"
echo -e "Open browser to - http://localhost:8993/geoserver/geowave/wms?service=WMS&version=1.1.0&request=GetMap&layers=geowave:ne_50m_admin_0_countries&styles=&bbox=-180.0,-90.0,180.0,90.0&width=768&height=384&srs=EPSG:4326&format=application/openlayers\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment