Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何在Ubuntu上正确启动/停止CouchDB 2.0_Linux_Ubuntu_Couchdb_Init_Start Stop Daemon - Fatal编程技术网

Linux 如何在Ubuntu上正确启动/停止CouchDB 2.0

Linux 如何在Ubuntu上正确启动/停止CouchDB 2.0,linux,ubuntu,couchdb,init,start-stop-daemon,Linux,Ubuntu,Couchdb,Init,Start Stop Daemon,我已经在Ubuntu 16.04上安装了CouchDB 2.0,并且可以通过启动~CouchDB/bin/CouchDB来运行它 现在我想让它在系统启动/关闭时正确启动和停止 该文档声明2.0中不再提供daemonization脚本,我希望避免使用runit 我曾尝试使用启动-停止守护进程,编写一个shell脚本(如果有帮助,请在下面提供)。这样我可以startCouchDB,但是stop不起作用,因为没有进程名为“CouchDB”(所有任务都委托给ERLang) 此外,当我更新rc.d cou

我已经在Ubuntu 16.04上安装了CouchDB 2.0,并且可以通过启动~CouchDB/bin/CouchDB来运行它

现在我想让它在系统启动/关闭时正确启动和停止

该文档声明2.0中不再提供daemonization脚本,我希望避免使用
runit

我曾尝试使用
启动-停止守护进程
,编写一个shell脚本(如果有帮助,请在下面提供)。这样我可以
start
CouchDB,但是
stop
不起作用,因为没有进程名为“CouchDB”(所有任务都委托给ERLang)

此外,当我
更新rc.d couchdb.sh默认值时
我得到一个错误
insserv:warning:script'couchdb.sh'缺少LSB标记和覆盖

那么,您建议如何制定一个干净的启动/停止程序?非常感谢

#!/bin/sh -e

DAEMON="/home/couchdb/bin/couchdb" 
daemon_OPT=""  
DAEMONUSER="couchdb" 
daemon_NAME="couchdb" 
PATH="/sbin:/bin:/usr/sbin:/usr/bin" 

test -x $DAEMON || exit 0

. /lib/lsb/init-functions

d_start () {
    log_daemon_msg "Starting system $daemon_NAME Daemon"
    start-stop-daemon --background --name $daemon_NAME --start --quiet --chuid $DAEMONUSER --exec $DAEMON -- $daemon_OPT
    log_end_msg $?
}

d_stop () {
    log_daemon_msg "Stopping system $daemon_NAME Daemon"
    start-stop-daemon --name $daemon_NAME --stop --retry 5 --quiet
    log_end_msg $?
}

case "$1" in

    start|stop)
        d_${1}
        ;;

    restart|reload|force-reload)
        d_stop
        d_start
        ;;

    force-stop)
        d_stop
        killall -q $daemon_NAME || true
        sleep 2
        killall -q -9 $daemon_NAME || true
        ;;

    status)
        status_of_proc "$daemon_NAME" "$DAEMON" "system-wide $daemon_NAME" && exit 0 || exit $?
        ;;
    *)
        echo "Usage: /etc/init.d/$daemon_NAME {start|stop|force-stop|restart|reload|force-reload|status}"
        exit 1
        ;;
esac
exit 0
从这里开始:

从这里开始:


ubuntu 16.04 LTS/couchdb v2.1.0
sudo服务couchdb站



sudo服务couchdb start

ubuntu16.04 LTS/couchdb v2.1.0
sudo服务couchdb站



sudo服务couchdb start

您可以使用操作系统附带的couchdb 1.6吗?或者至少是它的SystemD启动脚本/单元(
/lib/SystemD/system/couchdb.service
文件)?如果您需要2.0,最干净的方法就是重新打包一个新版本(使用Debian打包指南)。谢谢您的帮助。不幸的是,我不得不升级到2.0,因为1.6版本中的PockDB存在批量问题。Stack Overflow是一个解决编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参见帮助中心中的。也许或者会是一个更好的提问的地方。也看谢谢,同意了!我不知道这两个地方,我会检查一下。你能使用操作系统附带的couchdb 1.6吗?或者至少是它的SystemD启动脚本/单元(
/lib/SystemD/system/couchdb.service
文件)?如果您需要2.0,最干净的方法就是重新打包一个新版本(使用Debian打包指南)。谢谢您的帮助。不幸的是,我不得不升级到2.0,因为1.6版本中的PockDB存在批量问题。Stack Overflow是一个解决编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参见帮助中心中的。也许或者会是一个更好的提问的地方。也看谢谢,同意了!我不知道这两个其他地方,会检查一下。
# From: https://wiki.ubuntu.com/systemd
# This results in systemd being installed alongside upstart
apt-get -y install systemd libpam-systemd systemd-ui

# From: https://www.jamescoyle.net/how-to/2527-add-systemd-startup-script-for-couchdb ([Install] section is missing!)
# couchdb.service is a new file. Make it:
nano /etc/systemd/system/couchdb.service

--- file start (do not include this line) ---
[Unit]
Description=Couchdb service
After=network.target

[Service]
Type=simple
User=couchdb
ExecStart=/opt/couchdb/bin/couchdb -o /dev/stdout -e /dev/stderr
Restart=always

[Install]
WantedBy=multi-user.target
--- file end (do not include this line) ---

# This enables CouchDB automatically after reboot
systemctl  daemon-reload
systemctl  start couchdb.service
systemctl  enable couchdb.service

# Logging: see more about journalctl elsewhere. This shows the latest 500 logs.
journalctl -u couchdb.service | tail -n 500

# *** update the configuration file, see above example of a configuration of local.ini ***
service couchdb stop
# update local.ini
service couchdb start