Ask Your Question
1

How to make the SDC daemon run under a non-default account?

asked 2017-09-26 23:38:55 -0500

Mufy gravatar image

Say, you have installed SDC using the RPM install method. By default, the resulting SDC daemon would run under the default sdc:sdc user:group ownership. What to do if you need to run this as a different user?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-09-26 23:41:48 -0500

Mufy gravatar image

I did the following test on my machine to make the SDC service account run under a different account rather than the default 'sdc' after an RPM install.

=> First, I ensured that my daemon was running under the default account after an RPM install.

# ps -ef | grep configDir.*stream **sdc**      110244      1 11 04:09 ?        00:00:40 /usr/java/jdk1.8.0_144/bin/java
-classpath /opt/streamsets-datacollector/libexec/bootstrap-libs/main/streamsets-datacollector-bootstrap-2.7.1.1.jar:/opt/streamsets-datacollector/root-lib/*
-Djava.security.manager -Djava.security.policy=file:///etc/sdc/sdc-security.policy
-Xmx1024m -Xms1024m -server -XX:-OmitStackTraceInFastThrow -Doracle.jdbc.javaNetNio=true -Dsdc.dist.dir=/opt/streamsets-datacollector
-Dsdc.resources.dir=/var/lib/sdc-resources
-Dsdc.hostname=node-1.cluster -Dsdc.conf.dir=/etc/sdc -Dsdc.data.dir=/var/lib/sdc -Dsdc.log.dir=/var/log/sdc -javaagent:/opt/streamsets-datacollector/libexec/bootstrap-libs/main/streamsets-datacollector-bootstrap-2.7.1.1.jar
-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Djdk.nio.maxCachedBufferSize=262144 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/sdc/sdc_heapdump_1506485349.hprof
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/var/log/sdc/gc.log com.streamsets.pipeline.BootstrapMain
-mainClass com.streamsets.datacollector.main.DataCollectorMain
-apiClasspath /opt/streamsets-datacollector/api-lib/*.jar
-containerClasspath /etc/sdc:/opt/streamsets-datacollector/container-lib/*.jar
-streamsetsLibrariesDir /opt/streamsets-datacollector/streamsets-libs
-userLibrariesDir /opt/streamsets-datacollector/user-libs/
-configDir /etc/sdc -libsCommonLibDir /opt/streamsets-datacollector/libs-common-lib/
-streamsetsLibrariesExtraDir /opt/streamsets-datacollector/streamsets-libs-extras/

=> Added 'SDC_USER=root' and 'SDC_GROUP=root' in /etc/init.d/sdc in the relevant section as shown below.

# User $SDC_USER must exist
SDC_USER=root
if ! id -u "$SDC_USER" >/dev/null 2>&1
then
  echo "Error: user '$SDC_USER' does not exist."
  exit 4
fi

# Group $SDC_GROUP mut exist
SDC_GROUP=root
if ! groups "$SDC_USER" | grep "$SDC_GROUP" >/dev/null 2>&1
then
  echo "Error: group '$SDC_GROUP' does not exist."
  exit 4
fi

=> Did an SDC service restart.

# service sdc restart
INFO: sdc started successfully.

=> Ensured that my daemon was now running under the customized account (root, in this case).

# ps -ef | grep configDir.*stream
**root**    130870      1 99 04:15 pts/7    00:00:34 /usr/java/jdk1.8.0_144/bin/java -classpath /opt/streamsets-datacollector/libexec/bootstrap-libs/main/streamsets-datacollector-bootstrap-2.7.1.1.jar:/opt/streamsets-datacollector/root-lib/* -Djava.security.manager -Djava.security.policy=file:///etc/sdc/sdc-security.policy -Xmx1024m -Xms1024m -server -XX:-OmitStackTraceInFastThrow -Doracle.jdbc.javaNetNio=true -Dsdc.dist.dir=/opt/streamsets-datacollector -Dsdc.resources.dir=/var/lib/sdc-resources -Dsdc.hostname=node-1.cluster -Dsdc.conf.dir=/etc/sdc -Dsdc.data.dir=/var/lib/sdc -Dsdc.log.dir=/var/log/sdc -javaagent:/opt/streamsets-datacollector/libexec/bootstrap-libs/main/streamsets-datacollector-bootstrap-2.7.1.1.jar -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Djdk.nio.maxCachedBufferSize=262144 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/sdc/sdc_heapdump_1506485756.hprof -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/var/log/sdc/gc.log com.streamsets.pipeline.BootstrapMain -mainClass com.streamsets.datacollector.main.DataCollectorMain -apiClasspath /opt/streamsets-datacollector/api-lib/*.jar -containerClasspath /etc/sdc:/opt/streamsets-datacollector/container-lib/*.jar -streamsetsLibrariesDir /opt/streamsets-datacollector/streamsets-libs -userLibrariesDir /opt/streamsets-datacollector/user-libs/ -configDir /etc/sdc -libsCommonLibDir /opt/streamsets-datacollector/libs-common-lib/ -streamsetsLibrariesExtraDir /opt/streamsets-datacollector/streamsets-libs-extras/

Hope that helps.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-09-26 23:38:55 -0500

Seen: 178 times

Last updated: Sep 26 '17