kurych
3. Можно пожаловаться мейнтейнерам пакета, что бы они подправили скрипт запуска.
А куда жаловаться то?
kurych
1. Попробуйте создать каталог перед запуском демона
mkdir /var/run/couchdb
chown couchdb /var/run/couchdb
а потом посмотрите, сохранится ли он после остановки демона. Если сохранится, то проблема решена. Если нет, то

Пробовал этот вариант изначально, но каталог каждый раз создается при загрузке системы и владелец у него root
cucullus
надо думать, что это не проблема, а просто /var/run/couchdb/ создаётся при запуске демона. а сам /var/run вроде как живёт только до перезагрузки.
посмотрите /etc/rc.d/couchdb (или как там он зовётся)

Спасибо за ответ. В общем вот он /etc/rc.d/couchdb
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
### BEGIN INIT INFO
# Provides:          couchdb
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Apache CouchDB init script
# Description:       Apache CouchDB init script for the database server.
### END INIT INFO
SCRIPT_OK=0
SCRIPT_ERROR=1
DESCRIPTION="database server"
NAME=couchdb
SCRIPT_NAME=`basename $0`
COUCHDB=/usr/bin/couchdb
CONFIGURATION_FILE=/etc/conf.d/couchdb
RUN_DIR=/var/run/couchdb
LSB_LIBRARY=/lib/lsb/init-functions
if test ! -x $COUCHDB; then
    exit $SCRIPT_ERROR
fi
if test -r $CONFIGURATION_FILE; then
    . $CONFIGURATION_FILE
fi
log_daemon_msg () {
    stat_busy [email protected]
}
log_end_msg () {
    if test "$1" != "0"; then
      stat_fail
    else
      stat_done
    fi
    return $1
}
if test -r $LSB_LIBRARY; then
    . $LSB_LIBRARY
fi
run_command () {
    command="$1"
    if test -n "$COUCHDB_OPTIONS"; then
        command="$command $COUCHDB_OPTIONS"
    fi
    if test -n "$COUCHDB_USER"; then
        if su $COUCHDB_USER -s /bin/bash -c "$command"; then
            return $SCRIPT_OK
        else
            return $SCRIPT_ERROR
        fi
    else
        if $command; then
            return $SCRIPT_OK
        else
            return $SCRIPT_ERROR
        fi
    fi
}
start_couchdb () {
    # Start Apache CouchDB as a background process.
    mkdir -p "$RUN_DIR"
    command="$COUCHDB -b"
    if test -n "$COUCHDB_STDOUT_FILE"; then
        command="$command -o $COUCHDB_STDOUT_FILE"
    fi
    if test -n "$COUCHDB_STDERR_FILE"; then
        command="$command -e $COUCHDB_STDERR_FILE"
    fi
    if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
        command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
    fi
    run_command "$command" > /dev/null
}
stop_couchdb () {
    # Stop the running Apache CouchDB process.
    run_command "$COUCHDB -d" > /dev/null
}
display_status () {
    # Display the status of the running Apache CouchDB process.
    run_command "$COUCHDB -s"
}
parse_script_option_list () {
    # Parse arguments passed to the script and take appropriate action.
    case "$1" in
        start)
            log_daemon_msg "Starting $DESCRIPTION" $NAME
            if start_couchdb; then
                log_end_msg $SCRIPT_OK
            else
                log_end_msg $SCRIPT_ERROR
            fi
            ;;
        stop)
            log_daemon_msg "Stopping $DESCRIPTION" $NAME
            if stop_couchdb; then
                log_end_msg $SCRIPT_OK
            else
                log_end_msg $SCRIPT_ERROR
            fi
            ;;
        restart)
            log_daemon_msg "Restarting $DESCRIPTION" $NAME
            if stop_couchdb; then
                if start_couchdb; then
                    log_end_msg $SCRIPT_OK
                else
                    log_end_msg $SCRIPT_ERROR
                fi
            else
                log_end_msg $SCRIPT_ERROR
            fi
            ;;
        status)
            display_status
            ;;
        *)
            cat << EOF >&2
Usage: $SCRIPT_NAME {start|stop|restart|status}
EOF
            exit $SCRIPT_ERROR
            ;;
    esac
}
parse_script_option_list [email protected]

не придумал ничего толкового кроме как изменить
start_couchdb () {
    # Start Apache CouchDB as a background process.
    #mkdir -p "$RUN_DIR"  <---- изменил это 
    mkdir -p "$RUN_DIR" -m 0777    <----- на это
    command="$COUCHDB -b"
теперь couchdb стартует, но блин это костыль и данный костыль 100% слетит при последующем обновлении couchdb.
Всем привет, такая проблема установил couchdb, после установки стартует все нормально, записал в rc.conf запуск при загрузке системы, но при загрузке вылетает ошибка
Apache CouchDB needs write permission on the PID file: /var/run/couchdb/couchdb.pid
смотрю в /var/run/
0 drwxr-xr-x  2 root    root      40 дек.  23 21:12 couchdb
делаю
chown -R couchdb:root /var/run/couchdb

стартует без проблем, но после перезагрузки все опять повторяется. Никто не сталкивался с подобной проблемой?
Все обновил. Как оказалось, все не так сложно, а дело обстоит так: после того как обновилась сама PostgreSQL запустить сервер не получается. Ставим пакет postgresql-old-upgrade, переключаемся на пользователя postgres.
Идем в каталог /var/lib/postgres/ и выполняем команду
mv /var/lib/postgres/data /var/lib/postgres/olddata

Потом запускаем сервер, ждем когда он создаст новый каталог /var/lib/postgres/data и останавливаем сервер (да, перед тем как остановить я подключился к PostgreSQL и обновил роль для пользователя posgres, установил ему пароль ALTER ROLE postgres WITH PASSWORD ‘password’;).
Так как у меня была настроена авторизация к СУБД по паролю и метод md5 в /var/lib/postgres/data/pg_hba.conf (и в olddata/pg_hba.conf)
то в каталоге /var/lib/postgres/ я создал файл .pgpass с таким содержимым *:*:*:*:password (хост, порт, база, пользователь как написано на офф. сайте можно прописать звездочками, главное пароль указать который используется) . дайте ему 0600 права и потом запускаем проверку
[[email protected] ~]$ pg_upgrade --check -d /var/lib/postgres/olddata/ -D /var/lib/postgres/data/ -b /opt/pgsql-9.0/bin/ -B /usr/bin/ --old-port=5432 --new-port=5433 --user=postgres
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok
Checking database user is a superuser                       ok
Checking for prepared transactions                          ok
Checking for reg* system oid user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Creating catalog dump                                       ok
Checking for prepared transactions                          ok
Checking for presence of required libraries                 ok
стопорим старую версию
[[email protected] ~]$ /opt/pgsql-9.0/bin/pg_ctl stop -D /var/lib/postgres/olddata/
waiting for server to shut down.... done
server stopped
и запускаем само обновление
[[email protected] ~]$ pg_upgrade  -d /var/lib/postgres/olddata/ -D /var/lib/postgres/data/ -b /opt/pgsql-9.0/bin/ -B /usr/bin/ --old-port=5432 --new-port=5433 --user=postgres
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok
Checking database user is a superuser                       ok
Checking for prepared transactions                          ok
Checking for reg* system oid user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Creating catalog dump                                       ok
Checking for prepared transactions                          ok
Checking for presence of required libraries                 ok
| If pg_upgrade fails after this point, you must
| re-initdb the new cluster before continuing.
| You will also need to remove the ".old" suffix
| from /var/lib/postgres/olddata/global/pg_control.old.
Performing Upgrade
------------------
Adding ".old" suffix to old global/pg_control               ok
Analyzing all rows in the new cluster                       ok
Freezing all rows on the new cluster                        ok
Deleting new commit clogs                                   ok
Copying old commit clogs to new server                      ok
Setting next transaction id for new cluster                 ok
Resetting WAL archives                                      ok
Setting frozenxid counters in new cluster                   ok
Creating databases in the new cluster                       ok
Adding support functions to new cluster                     ok
Restoring database schema to new cluster                    ok
Removing support functions from new cluster                 ok
Restoring user relation files
                                                            ok
Setting next oid for new cluster                            ok
Creating script to delete old cluster                       ok
Upgrade complete
----------------
| Optimizer statistics are not transferred by pg_upgrade
| so consider running:
|       vacuumdb --all --analyze-only
| on the newly-upgraded cluster.
| Running this script will delete the old cluster's data files:
|       /var/lib/postgres/delete_old_cluster.sh
и все. Файл .pgpass можете удалить или оставить смотрите сами. Все от root запускаем PostgreSQL и все работает.
А если сервер уже обновился? т.е. уже обновленная версия и он не стартует потому что пишет, что базы для работы со старой версией
anthonio
А что нельзя сделать дамп а потом с него развернуть?
а можно подробнее?
та это понятно, хотя странно поставил postgresql-old-upgrade 9.0.5-1 и в olddata данные предыдущей версии. по идее обновляюсь до новой версии т.е. 9.1, и что то не выходит
пробую делать вот так и не выходит
[[email protected] ~]$ pg_upgrade --check -d /var/lib/postgres/olddata/ -D /var/lib/postgres/data/ -b /opt/pgsql-9.0/bin/ -B /usr/bin/
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions
This utility can only upgrade to PostgreSQL version 9.1.
Failure, exiting
Всем привет, помогите обновить PostgreSQL, раньше была версия 9.0, а сейчас пакет обновился до 9.1. Раньше не имел дела с этой СУБД, буду признателен за подсказку. Спасибо.