zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Sims" <m...@simsweb.org>
Subject Zookeeper run as non-root
Date Tue, 14 Aug 2012 21:02:55 GMT

Hello, we're just starting to implement a Zookeeper where I work on a Red
Hat system.

We've set everything up and it starts up just fine. The only issue is that
the process is run by the root user.

sudo /etc/init.d/zookeeper start

I have a zookeeper user ready to go. The init script we have makes a java
call to start up the process.

start)
    echo  -n "Starting zookeeper ... "
    if [ -f $ZOOPIDFILE ]; then
      if kill -0 `cat $ZOOPIDFILE` > /dev/null 2>&1; then
         echo $command already running as process `cat $ZOOPIDFILE`.
         exit 0
      fi
    fi
    nohup $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}"
"-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT"
2>&1 < /dev/null &
    if [ $? -eq 0 ]
    then
      if /bin/echo -n $! > "$ZOOPIDFILE"
      then
        sleep 1
        echo STARTED
      else
        echo FAILED TO WRITE PID
        exit 1
      fi
    else
      echo SERVER DID NOT START
      exit 1
    fi
    ;;


I've looked in to editing this script, including /etc/init.d/functions and
calling the daemon function to run the start as user zookeeper. But this
forks the process and the PID file is updated with the daemon process, not
the zookeeper process. This causes the stop feature to fail.

Before I go about re-writing this init script, I figure someone else must
have a proper way of starting this up as a non-root user.



Mime
View raw message