forked from prestodb/presto
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Presto RPM | ||
|
||
## RPM Package Build And Usage | ||
|
||
You can build an RPM package for Presto server and install Presto using the RPM. Thus, the installation is easier to manage on RPM-based systems. | ||
|
||
The RPM builds by default in Maven, and can be found under the directory `presto-server-rpm/target/` | ||
|
||
The RPM has a pre-requisite of Python >= 2.4. It also needs Oracle Java 1.8 update 40 (8u40 64-bit) pre-installed. The RPM installation will fail if any of these requirements are not | ||
satisfied. | ||
|
||
To install Presto using an RPM, run: | ||
|
||
rpm -i presto-server-<version>-1.0.x86_64.rpm | ||
|
||
This will install Presto in single node mode, where both coordinator and workers are co-located on localhost. This will deploy the necessary default configurations along with a service script to control the Presto server process. | ||
|
||
Uninstalling the RPM is like uninstalling any other RPM, just run: | ||
|
||
rpm -e presto | ||
|
||
Note: During uninstall, any Presto related files deployed will be deleted except for the Presto logs directory `/var/log/presto`. | ||
|
||
## Control Scripts | ||
|
||
The Presto RPM will also deploy service scripts to control the Presto server process. The script is configured with chkconfig, | ||
so that the service can be started automatically on OS boot. After installing Presto from the RPM, you can run: | ||
|
||
service presto [start|stop|restart|status] | ||
|
||
## Installation directory structure | ||
|
||
We use the following directory structure to deploy various Presto artifacts. | ||
|
||
* /usr/lib/presto/lib/: Various libraries needed to run the product. Plugins go in a plugin subdirectory. | ||
* /etc/presto: General Presto configuration files like node.properties, jvm.config, config.properties. Connector configs go in a catalog subdirectory | ||
* /etc/presto/env.sh: Java installation path used by Presto | ||
* /var/log/presto: Log files | ||
* /var/lib/presto/data: Data directory | ||
* /usr/shared/doc/presto: Docs | ||
* /etc/rc.d/init.d/presto: Control script | ||
|
||
The node.properties file requires the following two additional properties since our directory structure is different from what standard Presto expects. | ||
|
||
catalog.config-dir=/etc/presto/catalog | ||
plugin.dir=/usr/lib/presto/lib/plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.facebook.presto</groupId> | ||
<artifactId>presto-root</artifactId> | ||
<version>0.210-tw-0.59</version> | ||
</parent> | ||
|
||
<artifactId>presto-twitter-server-rpm</artifactId> | ||
<name>presto-twitter-server-rpm</name> | ||
<packaging>rpm</packaging> | ||
|
||
<properties> | ||
<air.main.basedir>${project.parent.basedir}</air.main.basedir> | ||
|
||
<air.check.skip-checkstyle>true</air.check.skip-checkstyle> | ||
<air.check.skip-duplicate-finder>true</air.check.skip-duplicate-finder> | ||
<air.check.skip-dependency-version-check>true</air.check.skip-dependency-version-check> | ||
<air.check.skip-extended>true</air.check.skip-extended> | ||
|
||
<server.tar.package>presto-twitter-server-${project.version}</server.tar.package> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.facebook.presto</groupId> | ||
<artifactId>presto-twitter-server</artifactId> | ||
<version>${project.version}</version> | ||
<type>tar.gz</type> | ||
<scope>runtime</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!-- Untar presto-twitter-server tgz to target build folder --> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>unpack</id> | ||
<goals> | ||
<goal>unpack</goal> | ||
</goals> | ||
<configuration> | ||
<skip>false</skip> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>com.facebook.presto</groupId> | ||
<artifactId>presto-twitter-server</artifactId> | ||
<version>${project.version}</version> | ||
<type>tar.gz</type> | ||
<outputDirectory>${project.build.outputDirectory} | ||
</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- Build presto-twitter-server rpm using the untarred artifacts --> | ||
<plugin> | ||
<groupId>com.teradata</groupId> | ||
<artifactId>redlinerpm-maven-plugin-td</artifactId> | ||
<version>2.1.5</version> | ||
<extensions>true</extensions> | ||
|
||
<configuration> | ||
<performCheckingForExtraFiles>false</performCheckingForExtraFiles> | ||
|
||
<packages> | ||
<package> | ||
<name>presto-twitter-server-rpm</name> | ||
<nameOverride>presto-twitter-server-rpm-${project.version}.x86_64.rpm</nameOverride> | ||
<version>${project.version}</version> | ||
<release>1</release> | ||
|
||
<group>Applications/Databases</group> | ||
<description>Presto Twitter Server RPM Package.</description> | ||
<architecture>x86_64</architecture> | ||
<preInstallScriptFile>src/main/rpm/preinstall</preInstallScriptFile> | ||
<postInstallScriptFile>src/main/rpm/postinstall</postInstallScriptFile> | ||
<postUninstallScriptFile>src/main/rpm/postremove | ||
</postUninstallScriptFile> | ||
|
||
<dependencies> | ||
<dependency> | ||
<name>python</name> | ||
<version>[2.4,)</version> | ||
</dependency> | ||
<dependency> | ||
<name>/usr/sbin/useradd</name> | ||
</dependency> | ||
<dependency> | ||
<name>/usr/sbin/groupadd</name> | ||
</dependency> | ||
<dependency> | ||
<name>/usr/bin/uuidgen</name> | ||
</dependency> | ||
</dependencies> | ||
|
||
<links> | ||
<link> | ||
<path>/usr/lib/presto/etc</path> | ||
<target>/etc/presto</target> | ||
</link> | ||
</links> | ||
|
||
<rules> | ||
<rule> | ||
<destination>/usr/lib/presto/bin</destination> | ||
<base>${server.tar.package}/bin</base> | ||
<!-- make sure launcher scripts are executable --> | ||
<fileMode>0755</fileMode> | ||
<includes> | ||
<include>*</include> | ||
</includes> | ||
</rule> | ||
|
||
<rule> | ||
<destination>/usr/lib/presto/bin</destination> | ||
<base>${server.tar.package}/bin</base> | ||
<!-- copy sub folders --> | ||
<includes> | ||
<include>*/**</include> | ||
</includes> | ||
</rule> | ||
|
||
<rule> | ||
<destination>/etc/init.d</destination> | ||
<base>dist/etc/init.d</base> | ||
<!-- make sure init.d scripts are executable --> | ||
<fileMode>0755</fileMode> | ||
<includes> | ||
<include>*</include> | ||
</includes> | ||
</rule> | ||
|
||
<rule> | ||
<!-- This should go to just /usr/lib/presto eventually. But that needs modifying | ||
launcher.py in airlift, to have a configurable option for install_path --> | ||
<destination>/usr/lib/presto/lib</destination> | ||
<base>${server.tar.package}/lib</base> | ||
<includes> | ||
<include>*</include> | ||
</includes> | ||
</rule> | ||
|
||
<rule> | ||
<destination>/usr/lib/presto/lib/plugin</destination> | ||
<base>${server.tar.package}/plugin</base> | ||
<includes> | ||
<include>*/*</include> | ||
</includes> | ||
</rule> | ||
|
||
<rule> | ||
<destination>/etc/presto</destination> | ||
<base>dist/config</base> | ||
<includes> | ||
<include>*</include> | ||
</includes> | ||
</rule> | ||
|
||
<rule> | ||
<destination>/usr/shared/doc/presto</destination> | ||
<base>${server.tar.package}</base> | ||
<includes> | ||
<include>README.txt</include> | ||
</includes> | ||
</rule> | ||
|
||
<!-- Add these rules so that .spec knows these dirs are to be removed too on rpm -e --> | ||
<rule> | ||
<destination>/usr/lib/presto</destination> | ||
</rule> | ||
<rule> | ||
<destination>/usr/lib/presto/lib</destination> | ||
</rule> | ||
|
||
</rules> | ||
</package> | ||
</packages> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
6 changes: 6 additions & 0 deletions
6
presto-twitter-server-rpm/src/main/resources/dist/config/config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#single node install config | ||
coordinator=true | ||
node-scheduler.include-coordinator=true | ||
http-server.http.port=8080 | ||
discovery-server.enabled=true | ||
discovery.uri=http://localhost:8080 |
9 changes: 9 additions & 0 deletions
9
presto-twitter-server-rpm/src/main/resources/dist/config/jvm.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-server | ||
-Xmx16G | ||
-XX:-UseBiasedLocking | ||
-XX:+UseG1GC | ||
-XX:+ExplicitGCInvokesConcurrent | ||
-XX:+HeapDumpOnOutOfMemoryError | ||
-XX:+UseGCOverheadLimit | ||
-XX:+ExitOnOutOfMemoryError | ||
-XX:ReservedCodeCacheSize=512M |
7 changes: 7 additions & 0 deletions
7
presto-twitter-server-rpm/src/main/resources/dist/config/node.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node.environment=test | ||
node.id=$(uuid-generated-nodeid) | ||
node.data-dir=/var/lib/presto/data | ||
catalog.config-dir=/etc/presto/catalog | ||
plugin.dir=/usr/lib/presto/lib/plugin | ||
node.server-log-file=/var/log/presto/server.log | ||
node.launcher-log-file=/var/log/presto/launcher.log |
87 changes: 87 additions & 0 deletions
87
presto-twitter-server-rpm/src/main/resources/dist/etc/init.d/presto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
# | ||
# Manages a Presto node service | ||
# | ||
# chkconfig: 345 85 15 | ||
# description: Presto node | ||
# | ||
### BEGIN INIT INFO | ||
# Provides: presto | ||
# Short-Description: presto node | ||
# Default-Start: 3 4 5 | ||
# Default-Stop: 0 1 2 6 | ||
# Required-Start: $syslog $remote_fs | ||
# Required-Stop: $syslog $remote_fs | ||
# Should-Start: | ||
# Should-Stop: | ||
### END INIT INFO | ||
|
||
SCRIPT_NAME=$0 | ||
ACTION_NAME=$1 | ||
SERVICE_NAME='presto' | ||
SERVICE_USER='presto' | ||
|
||
# Launcher Config. | ||
# Use data-dir from node.properties file (assumes it to be at /etc/presto). For other args use defaults from rpm install | ||
NODE_PROPERTIES=/etc/presto/node.properties | ||
DATA_DIR=$(grep -Po "(?<=^node.data-dir=).*" $NODE_PROPERTIES) | ||
SERVER_LOG_FILE=$(grep -Po "(?<=^node.server-log-file=).*" $NODE_PROPERTIES) | ||
LAUNCHER_LOG_FILE=$(grep -Po "(?<=^node.launcher-log-file=).*" $NODE_PROPERTIES) | ||
CONFIGURATION=(--launcher-config /usr/lib/presto/bin/launcher.properties --data-dir "$DATA_DIR" --node-config "$NODE_PROPERTIES" --jvm-config /etc/presto/jvm.config --config /etc/presto/config.properties --launcher-log-file "${LAUNCHER_LOG_FILE:-/var/log/presto/launcher.log}" --server-log-file "${SERVER_LOG_FILE:-/var/log/presto/server.log}") | ||
|
||
source /etc/presto/env.sh | ||
|
||
start () { | ||
echo "Starting ${SERVICE_NAME} " | ||
if [ -z "$JAVA8_HOME" ] | ||
then | ||
echo "Warning: No value found for JAVA8_HOME. Default Java will be used." | ||
sudo -u $SERVICE_USER /usr/lib/presto/bin/launcher start "${CONFIGURATION[@]}" | ||
else | ||
sudo -u $SERVICE_USER PATH=${JAVA8_HOME}/bin:$PATH /usr/lib/presto/bin/launcher start "${CONFIGURATION[@]}" | ||
fi | ||
return $? | ||
} | ||
|
||
stop () { | ||
echo "Stopping ${SERVICE_NAME} " | ||
sudo -u $SERVICE_USER /usr/lib/presto/bin/launcher stop "${CONFIGURATION[@]}" | ||
return $? | ||
} | ||
|
||
status () { | ||
echo "Getting status for ${SERVICE_NAME} " | ||
sudo -u $SERVICE_USER /usr/lib/presto/bin/launcher status "${CONFIGURATION[@]}" | ||
return $? | ||
} | ||
|
||
|
||
restart () { | ||
sudo -u $SERVICE_USER /usr/lib/presto/bin/launcher restart "${CONFIGURATION[@]}" | ||
return $? | ||
} | ||
|
||
# TODO: Add kill | ||
|
||
usage () { | ||
echo $"Usage: ${SCRIPT_NAME} {start|stop|restart|status}" | ||
return 3 | ||
} | ||
|
||
case "${ACTION_NAME}" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
restart) | ||
restart | ||
;; | ||
status) | ||
status | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|restart|status}" | ||
exit 3 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Post installation script | ||
|
||
# Dynamically populated directories that we expect to exist but do | ||
# not want to remove when removing the RPM. Ideally, we would do this | ||
# via the RPM building plugin, but adding empty directories is not | ||
# supported. | ||
install --directory --mode=755 /var/lib/presto | ||
install --directory --mode=755 /var/log/presto | ||
|
||
# Populate node.id from uuidgen by replacing template with the node uuid | ||
sed -i "s/\$(uuid-generated-nodeid)/$(uuidgen)/g" /etc/presto/node.properties | ||
|
||
# move the presto_env.sh created during pre-install to presto config location | ||
if [ -e /tmp/presto_env.sh ] | ||
then | ||
mv /tmp/presto_env.sh /etc/presto/env.sh | ||
fi | ||
|
||
chown -R presto:presto /var/lib/presto | ||
chown -R presto:presto /var/log/presto | ||
chown -R presto:presto /etc/presto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Post erase script | ||
|
||
# if this is the last version of presto-server-rpm being removed (i.e. not on upgrade) | ||
if [ "$1" -eq 0 ] | ||
then | ||
# Delete the conf directory manually during uninstall. | ||
# rpm -e wont remove it, because this directory was manually updated in postinstall | ||
rm -rf /etc/presto | ||
# Delete the data directory manually during uninstall. | ||
# rpm -e wont remove it, because this directory may later contain files not | ||
# deployed by the rpm | ||
rm -rf /var/lib/presto | ||
fi |
Oops, something went wrong.