zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nn chuong411 <nnchuong...@gmail.com>
Subject Re: Zookeeper run as non-root
Date Wed, 15 Aug 2012 02:42:16 GMT
Hi Matthew,
    Re-writing srcript is a costly job. I've also run zookeeper as a
non-root user since last month. Everything still go fine up to now and here
are what I have done:
    -Download zookeeper, up-pack it and upload to my server under
/home/zookeeper (home for zookeeper user)
    -Configure zoo.cfg at each server, mostly change dataDir back to
some folder under /home/zookeeper
    -Create a myid file under dataDir at each server
    -Writing a bash script which first move to bin folder and then invoke
zkServer.sh start
    -Log in to server using zookeeper account and run above script.
    That's all.
    Honestly, I don't have any need to automatically start zookeeper at
start-up time, so placing any script under /etc/init.d/ is not under my
consideration. Hope this will help you.
P/S: make sure all above files and folder belong to zookeeper, not root
user.

On Wed, Aug 15, 2012 at 4:02 AM, Matthew Sims <matt@simsweb.org> wrote:

>
> 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.
>
>
>


-- 
Nguyen Nam Chuong
Software Engineer - VNG Cooperation
Ho Chi Minh City - Vietnam

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message