<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
        當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng)

        來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-09 16:21:14
        文檔

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng)

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng):循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng) 在手動(dòng)安裝(針對(duì)源碼編譯PG或者是解壓縮版安裝PG的情形)情況下,PG并不是在開機(jī)的情況下自動(dòng)啟動(dòng),在關(guān)機(jī)的情況下自動(dòng)停止,作為DBA人員來(lái)說(shuō),顯然這樣的情形是無(wú)法接受的。 www.2cto.com 1. win
        推薦度:
        導(dǎo)讀循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng):循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng) 在手動(dòng)安裝(針對(duì)源碼編譯PG或者是解壓縮版安裝PG的情形)情況下,PG并不是在開機(jī)的情況下自動(dòng)啟動(dòng),在關(guān)機(jī)的情況下自動(dòng)停止,作為DBA人員來(lái)說(shuō),顯然這樣的情形是無(wú)法接受的。 www.2cto.com 1. win

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng) 在手動(dòng)安裝(針對(duì)源碼編譯PG或者是解壓縮版安裝PG的情形)情況下,PG并不是在開機(jī)的情況下自動(dòng)啟動(dòng),在關(guān)機(jī)的情況下自動(dòng)停止,作為DBA人員來(lái)說(shuō),顯然這樣的情形是無(wú)法接受的。 www.2cto.com 1. windows下的服務(wù)自啟

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng)

        在手動(dòng)安裝(針對(duì)源碼編譯PG或者是解壓縮版安裝PG的情形)情況下,PG并不是在開機(jī)的情況下自動(dòng)啟動(dòng),在關(guān)機(jī)的情況下自動(dòng)停止,作為DBA人員來(lái)說(shuō),顯然這樣的情形是無(wú)法接受的。

        www.2cto.com

        1. windows下的服務(wù)自啟動(dòng)

        在Windows下, 可以使用pg_ctl命令生成PostgreSQL服務(wù),并讓它自啟動(dòng)。實(shí)際上,安裝版本也是這么做的。 我們不妨看看pg_ctl命令的詳細(xì)幫助先:

        D:\pg921>pg_ctl --help

        pg_ctl is a utility to initialize, start, stop, or control a PostgreSQL server.

        Usage:

        pg_ctl init[db] [-D DATADIR] [-s] [-o "OPTIONS"]

        pg_ctl start [-w] [-t SECS] [-D DATADIR] [-s] [-l FILENAME] [-o "OPTIONS"]

        pg_ctl stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]

        pg_ctl restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]

        [-o "OPTIONS"]

        pg_ctl reload [-D DATADIR] [-s]

        pg_ctl status [-D DATADIR]

        pg_ctl promote [-D DATADIR] [-s]

        pg_ctl kill SIGNALNAME PID

        pg_ctl register [-N SERVICENAME] [-U USERNAME] [-P PASSWORD] [-D DATADIR]

        [-S START-TYPE] [-w] [-t SECS] [-o "OPTIONS"]

        pg_ctl unregister [-N SERVICENAME]

        Common options:

        -D, --pgdata=DATADIR location of the database storage area

        -s, --silent only print errors, no informational messages

        -t, --timeout=SECS seconds to wait when using -w option

        -V, --version output version information, then exit

        -w wait until operation completes

        -W do not wait until operation completes

        -?, --help show this help, then exit

        (The default is to wait for shutdown, but not for start or restart.)

        If the -D option is omitted, the environment variable PGDATA is used.

        Options for start or restart:

        -c, --core-files not applicable on this platform

        -l, --log=FILENAME write (or append) server log to FILENAME

        -o OPTIONS command line options to pass to postgres

        (PostgreSQL server executable) or initdb

        -p PATH-TO-POSTGRES normally not necessary

        Options for stop or restart:

        -m, --mode=MODE MODE can be "smart", "fast", or "immediate"

        Shutdown modes are:

        smart quit after all clients have disconnected

        fast quit directly, with proper shutdown

        immediate quit without complete shutdown; will lead to recovery on restart

        Allowed signal names for kill:

        ABRT HUP INT QUIT TERM USR1 USR2

        Options for register and unregister:

        -N SERVICENAME service name with which to register PostgreSQL server

        -P PASSWORD password of account to register PostgreSQL server

        -U USERNAME user name of account to register PostgreSQL server

        -S START-TYPE service start type to register PostgreSQL server

        Start types are:

        auto start service automatically during system startup (default)

        demand start service on demand

        Report bugs to .

        從上邊可以看出,pg_ctl register用于生成服務(wù),而pg_ctl unregister -N <服務(wù)名>用于刪除一個(gè)服務(wù)。

        如:

        D:\pg921>pg_ctl register -N pg921 -D d:\pg921\data -S auto -w -t 10 -l d:/pg921/log/pg921.log -o "-p 5433"

        此命令,即是要生成一個(gè)服務(wù):pg921, 啟動(dòng)方式: -S auto, 自啟動(dòng),如果想生成手動(dòng)啟動(dòng),就用-S demand來(lái)指定。

        -t 10,意指等待10秒鐘, 實(shí)際上可以設(shè)定的長(zhǎng)一些(在生產(chǎn)環(huán)境中).

        -l d:/pg921/log/pg921.log, 指定生成的日志文件的位置。

        -o "-p 5433", 將服務(wù)端口號(hào)改為5433。

        驗(yàn)證一下上述命令生成的效果:

        D:\pg921>net start pg921

        The pg921 service is starting.

        The pg921 service was started successfully.

        D:\pg921>psql -p 5433 iihero

        psql (9.2.1)

        Type "help" for help.

        iihero=# \q

        2. Linux下的服務(wù)自啟動(dòng)

        在Linux下,我們需要寫一個(gè)自啟動(dòng)的腳本,至少支持兩個(gè)命令選項(xiàng): start 和 stop,并將這個(gè)腳本建立適當(dāng)?shù)逆溄印N覀兙鸵訳buntu10為例,

        先看看系統(tǒng)有沒(méi)有chkconfig命令工具: www.2cto.com

        xionghe@seanlinux2:~$ chkconfig

        程序“chkconfig”尚未安裝。 您可以使用以下命令安裝:

        sudo apt-get install chkconfig

        xionghe@seanlinux2:~$ sudo apt-get install chkconfig

        腳本內(nèi)容如下: 放入目錄/etc/init.d目錄下邊

        #! /bin/sh

        # Installation prefix

        prefix=/home/xionghe/pgsql

        # Data directory

        PGDATA="/home/xionghe/pgsql/data"

        # Who to run the postmaster as, usually "postgres". (NOT "root")

        PGUSER=xionghe

        # Where to keep a log file

        PGLOG="$PGDATA/serverlog"

        # It's often a good idea to protect the postmaster from being killed by the

        # OOM killer (which will tend to preferentially kill the postmaster because

        # of the way it accounts for shared memory). Setting the OOM_ADJ value to

        # -17 will disable OOM kill altogether. If you enable this, you probably want

        # to compile PostgreSQL with "-DLINUX_OOM_ADJ=0", so that individual backends

        # can still be killed by the OOM killer.

        #OOM_ADJ=-17

        ## STOP EDITING HERE

        # The path that is to be used for the script

        PATH=/home/xionghe/pgsql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

        # What to use to start up the postmaster. (If you want the script to wait

        # until the server has started, you could use "pg_ctl start -w" here.

        # But without -w, pg_ctl adds no value.)

        DAEMON="$prefix/bin/postmaster"

        # What to use to shut down the postmaster

        PGCTL="$prefix/bin/pg_ctl"

        set -e

        # Only start if we can find the postmaster.

        test -x $DAEMON ||

        {

        echo "$DAEMON not found"

        if [ "$1" = "stop" ]

        then exit 0

        else exit 5

        fi

        }

        # Parse command line parameters.

        case $1 in

        start)

        echo -n "Starting PostgreSQL: "

        test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adj

        su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1

        echo "ok"

        ;;

        stop)

        echo -n "Stopping PostgreSQL: "

        su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"

        echo "ok"

        ;;

        restart)

        echo -n "Restarting PostgreSQL: "

        su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"

        test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adj

        su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1

        echo "ok"

        ;;

        reload)

        echo -n "Reload PostgreSQL: "

        su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"

        echo "ok"

        ;;

        status)

        su - $PGUSER -c "$PGCTL status -D '$PGDATA'"

        ;;

        *)

        # Print help

        echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2

        exit 1

        ;;

        esac

        exit 0

        建立相應(yīng)鏈接:

        root@seanlinux2:/etc# ln -s /etc/init.d/postgresql /etc/rc0.d/K02postgresql

        root@seanlinux2:/etc# ln -s /etc/init.d/postgresql /etc/rc1.d/K02postgresql

        root@seanlinux2:/etc# ln -s /etc/init.d/postgresql /etc/rc2.d/K02postgresql

        root@seanlinux2:/etc# ln -s /etc/init.d/postgresql /etc/rc3.d/K98postgresql

        root@seanlinux2:/etc# ln -s /etc/init.d/postgresql /etc/rc4.d/K98postgresql

        root@seanlinux2:/etc# ln -s /etc/init.d/postgresql /etc/rc5.d/K98postgresql

        聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng)

        循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng):循序漸進(jìn)PostgreSQL:實(shí)現(xiàn)PostgreSQL自啟動(dòng) 在手動(dòng)安裝(針對(duì)源碼編譯PG或者是解壓縮版安裝PG的情形)情況下,PG并不是在開機(jī)的情況下自動(dòng)啟動(dòng),在關(guān)機(jī)的情況下自動(dòng)停止,作為DBA人員來(lái)說(shuō),顯然這樣的情形是無(wú)法接受的。 www.2cto.com 1. win
        推薦度:
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 中文字幕亚洲无线码a| 日韩毛片免费在线观看| 亚洲AV无码专区在线播放中文| 一级特黄a免费大片| 亚洲无码日韩精品第一页| 四虎一区二区成人免费影院网址| 亚洲AV伊人久久青青草原| 亚洲精品黄色视频在线观看免费资源 | 久久99亚洲综合精品首页| 两个人日本WWW免费版| 亚洲成人在线电影| AA免费观看的1000部电影| 亚洲美国产亚洲AV| 亚洲第一区在线观看| 九九美女网站免费| 国产成人亚洲合集青青草原精品| 日韩高清在线高清免费| xxxx日本在线播放免费不卡| 亚洲人成人网站色www| 99久久99久久精品免费看蜜桃 | 日本黄色免费观看| 一级黄色毛片免费看| 亚洲AV天天做在线观看| 噼里啪啦电影在线观看免费高清| 国产成人亚洲精品播放器下载| 国产亚洲av片在线观看播放 | 亚洲国产黄在线观看| a成人毛片免费观看| 亚洲国产精品日韩在线| 爽爽日本在线视频免费| 成人毛片100免费观看| 香蕉大伊亚洲人在线观看| 亚洲性日韩精品国产一区二区| 99久在线国内在线播放免费观看| 亚洲啪AV永久无码精品放毛片| 亚洲午夜无码片在线观看影院猛 | 日韩在线播放全免费| 免费国产va在线观看| 亚洲国产综合第一精品小说| va亚洲va日韩不卡在线观看| 69视频免费观看l|