{"id":4263,"date":"2015-01-21T18:58:19","date_gmt":"2015-01-21T10:58:19","guid":{"rendered":"https:\/\/www.hmouse.tk\/?p=4263"},"modified":"2015-11-04T11:32:35","modified_gmt":"2015-11-04T03:32:35","slug":"%e5%a5%bd%e7%94%a8%e7%9a%84git%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7-2","status":"publish","type":"post","link":"https:\/\/www.hmouse.cn\/?p=4263","title":{"rendered":"\u597d\u7528\u7684git\u7ba1\u7406\u5de5\u5177"},"content":{"rendered":"<p>\u4e4b\u524d\u4e00\u76f4\u5bf9git\u7684\u8d26\u53f7\u548c\u6743\u9650\u7ba1\u7406\u5f88\u662f\u5934\u5927\uff0c\u5728\u65b0\u516c\u53f8\u53d1\u73b0\u4e00\u6b3e\u8f6f\u4ef6\u5f88\u597d\u7684\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002gitlab\u4ed6\u7684\u6743\u9650\u7ba1\u7406\u548c\u7528\u6237\u7ba1\u7406\u5f88\u662f\u65b9\u4fbf\uff1a<\/p>\n<p>\u5b89\u88c5\uff1a(<a title=\"https:\/\/about.gitlab.com\/downloads\/\" href=\"https:\/\/about.gitlab.com\/downloads\/\">https:\/\/about.gitlab.com\/downloads\/<\/a>)<\/p>\n<p>Download the Omnibus package and install everything<\/p>\n<pre>curl -O https:\/\/downloads-packages.s3.amazonaws.com\/centos-6.6\/gitlab-7.6.2_omnibus.5.3.0.ci.1-1.el6.x86_64.rpm\nsudo yum install openssh-server\nsudo yum install postfix\nsudo yum install cronie\nsudo service postfix start\nsudo chkconfig postfix on\nsudo rpm -i gitlab-7.6.2_omnibus.5.3.0.ci.1-1.el6.x86_64.rpm<\/pre>\n<p>Configure and start GitLab<\/p>\n<pre><p>sudo gitlab-ctl reconfigure\nsudo lokkit -s http -s ssh&nbsp; (\u9632\u706b\u5899\u76f8\u5173\u610f\u4e49\u4e0d\u662f\u5f88\u5927)<\/p><\/pre>\n<p>\u914d\u7f6e\u76f8\u5173<\/p>\n<p>Browse to the hostname and login <br \/>Username: root <br \/>Password: 5iveL!fe <\/p>\n<p><i><\/i>For troubleshooting and configuration options please see the <a href=\"https:\/\/gitlab.com\/gitlab-org\/omnibus-gitlab\/blob\/master\/README.md\">Omnibus GitLab readme<\/a> <\/p>\n<p>\u5176\u4e2d\u4e3b\u8981\u6709\u7528\u7684\u5c31\u662f<code>gitlab-ctl \u63a7\u5236\u53f0\u3002<\/code> <\/p>\n<p><code>have fun\uff01<\/code><\/p>\n<p>gitlab\u7684\u5907\u4efd\u4e0e\u6062\u590d<\/p>\n<p><a title=\"https:\/\/gitlab.com\/gitlab-org\/gitlab-ce\/blob\/master\/doc\/raketasks\/backup_restore.md\" href=\"https:\/\/gitlab.com\/gitlab-org\/gitlab-ce\/blob\/master\/doc\/raketasks\/backup_restore.md\">https:\/\/gitlab.com\/gitlab-org\/gitlab-ce\/blob\/master\/doc\/raketasks\/backup_restore.md<\/a><\/p>\n<p>&nbsp;<\/p>\n<pre><code># use this command if you've installed GitLab with the Omnibus package\nsudo gitlab-rake gitlab:backup:create<\/code><\/pre>\n<pre><code>sudo cp 1393513186_gitlab_backup.tar \/var\/opt\/gitlab\/backups\/\n<\/code><\/pre>\n<p>Next, restore the backup by running the restore command. You need to specify the timestamp of the backup you are restoring.<\/p>\n<pre><code># Stop processes that are connected to the database\nsudo gitlab-ctl stop unicorn\nsudo gitlab-ctl stop sidekiq\n\n# This command will overwrite the contents of your GitLab database!\nsudo gitlab-rake gitlab:backup:restore BACKUP=1393513186\n\n# Start GitLab\nsudo gitlab-ctl start\n\n# Create satellites\nsudo gitlab-rake gitlab:satellites:create\n\n# Check GitLab\nsudo gitlab-rake gitlab:check SANITIZE=true<\/code><\/pre>\n<p>git \u7684rpm \u8def\u5f84<\/p>\n<p><a title=\"https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/\" href=\"https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/\">https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>git\u7684\u5347\u7ea7 \u548c\u4fee\u6539\u914d\u7f6e<\/p>\n<p>\u5907\u4efd \u6309\u4e0a\u9762\u5199\u7684\u5907\u4efd<\/p>\n<p>\u5347\u7ea7 yum -y install gitlab-ce<\/p>\n<p>\u66f4\u6539\u914d\u7f6e gitlab-ctl&nbsp; reconfigure<\/p>\n<p>\u91cd\u542f&nbsp;&nbsp; gitlab-ctl restart<\/p>\n<p>&nbsp;<\/p>\n<p>\u5947\u602a\u7684 postgresql \u95ee\u9898<\/p>\n<p><a href=\"https:\/\/www.hmouse.cn\/wp-content\/uploads\/2015\/06\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.hmouse.cn\/wp-content\/uploads\/2015\/06\/image_thumb6.png\" width=\"244\" height=\"41\"><\/a> <\/p>\n<p>\u4e4b\u524d\u4e00\u6b21\u5f02\u5e38\uff0c\u7136\u540egitlab \u4e00\u76f4\u65e0\u6cd5\u8bbf\u95ee\uff0c\u540e\u6765\u6392\u67e5\u5230\u662fpostgresql \u7684\u95ee\u9898\u3002\u4ece\u65e5\u5fd7\u4e2d\u53d1\u73b0postgresql \u7684\u62a5\u9519\u662f\u4e0b\u9762\u3002\u4e4b\u524d\u4e00\u76f4\u4ee5\u4e3a\u662f\u8fdb\u7a0b\u7684\u539f\u56e0\uff0c\u540e\u6765\u624d\u53d1\u73b0\u771f\u7684\u662f\u6743\u9650\u7684\u95ee\u9898\uff0c\u5982\u679c\u628a\/tmp\u7684\u6743\u9650\u8bbe\u7f6e\u4e3a777\uff0c\u95ee\u9898\u89e3\u51b3\u3002\u4f46\u662f\u6211\u4ece\u5176\u4ed6\u673a\u5668\u53d1\u73b0\u90fd\u662f777\u6743\u9650\uff0c\u5f88\u5947\u602a\u4e3a\u4ec0\u4e48\u4e0d\u884c\u3002<\/p>\n<p><font color=\"#ff0000\">\u540e\u6765\u786e\u8ba4\u662f\u670d\u52a1\u5668\u7684\u95ee\u9898 tmp\u7684\u76ee\u5f55 \u5c5e\u4e3b\u90fd\u4e0d\u662froot\u4e86<\/font><\/p>\n<p>&nbsp;<\/p>\n<p>su &#8211; gitlab-psql <\/p>\n<p>-sh-4.1$ \/opt\/gitlab\/embedded\/bin\/postgres -D \/var\/opt\/gitlab\/postgresql\/data<br \/>FATAL:&nbsp; lock file &#8220;postmaster.pid&#8221; already exists<br \/>HINT:&nbsp; Is another postmaster (PID 31417) running in data directory &#8220;\/var\/opt\/gitlab\/postgresql\/data&#8221;? <\/p>\n<p>\u8fd9\u6837\u53ef\u4ee5\u5355\u542f\u52a8postgresql \u7684\u3002<\/p>\n<p>\u95ee\u9898\u89e3\u51b3\uff0c\u540e\u6765\u53d1\u73b0\u4e00\u4e2a\u6bd4\u8f83\u597d\u7684\u6587\u7ae0\uff1a<\/p>\n<p><a title=\"http:\/\/cloudate.net\/?p=1352\" href=\"http:\/\/cloudate.net\/?p=1352\">http:\/\/cloudate.net\/?p=1352<\/a>&nbsp; \u662f\u5904\u7406\u4e8b\u52a1\u65e5\u5fd7\u7684\u95ee\u9898\u3002\u7559\u4f5c\u5907\u7528<\/p>\n<h3>Postgresql(Gitlab)\u4fee\u6539\u4e86\u4e8b\u7269\u65e5\u5fd7\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8<\/h3>\n<p>\u4eca\u5929\u4e00\u4e2a\u540c\u4e8b\u4fee\u6539\u4e86Gitlab\u4e2dPostgresql\u7684\u4e8b\u7269\u65e5\u5fd7\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8\uff0c\u65e5\u5fd7\u8def\u5f84\u5982\u4e0b\uff1a<\/p>\n<pre>\/var\/opt\/gitlab\/postgresql\/data\/pg_xlog\/0000000100000000000000001\n<\/pre>\n<p>\u542f\u52a8gitlab\u62a5\u9519:<\/p>\n<pre>2015-05-07_06:57:31.44580 LOG: startup process (PID 24323) was terminated by signal 6: Aborted\n2015-05-07_06:57:31.44584 LOG: aborting startup due to startup process failure\n2015-05-07_06:57:32.57551 LOG: database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_06:57:32.57616 LOG: invalid magic number 209F in log file 0, segment 1, offset 13164544\n2015-05-07_06:57:32.57626 LOG: invalid primary checkpoint record\n2015-05-07_06:57:32.57633 LOG: invalid secondary checkpoint record\n2015-05-07_06:57:32.57637 PANIC: could not locate a valid checkpoint record\n2015-05-07_06:57:32.58162 LOG: startup process (PID 24328) was terminated by signal 6: Aborted\n2015-05-07_06:57:32.58165 LOG: aborting startup due to startup process failure\n2015-05-07_06:57:33.71350 LOG: database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_06:57:33.71406 LOG: invalid magic number 209F in log file 0, segment 1, offset 13164544\n2015-05-07_06:57:33.71422 LOG: invalid primary checkpoint record\n2015-05-07_06:57:33.71440 LOG: invalid secondary checkpoint record\n2015-05-07_06:57:33.71452 PANIC: could not locate a valid checkpoint record\n2015-05-07_06:57:33.71862 LOG: startup process (PID 24333) was terminated by signal 6: Aborted\n2015-05-07_06:57:33.71865 LOG: aborting startup due to startup process failure\n2015-05-07_06:57:34.83445 LOG: database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_06:57:34.83475 LOG: invalid magic number 209F in log file 0, segment 1, offset 13164544\n2015-05-07_06:57:34.83484 LOG: invalid primary checkpoint record\n2015-05-07_06:57:34.83490 LOG: invalid secondary checkpoint record\n<\/pre>\n<p>\u53ef\u89c1\uff0c\u4e8b\u7269\u65e5\u5fd7\u683c\u5f0f\u88ab\u6bc1\u574f\uff0c\u6240\u4ee5\uff0c\u627e\u4e0d\u5230\u9b54\u6570\u3002\u6211\u5f00\u59cb\u8ba4\u4e3a\u4e8b\u7269\u65e5\u5fd7\u4e0d\u662f\u5fc5\u987b\u7684\u6570\u636e\u65e5\u5fd7\uff0c\u9996\u5148\u5c1d\u8bd5\u4e86\u5220\u9664\u64cd\u4f5c\uff0c\u800c\u4e14\u5728\u6211\u7684\u4e2a\u4eba\u7535\u8111\u7684Gitlab\u4e0a\u505a\u4e86\u5c1d\u8bd5\uff0c\u5220\u9664\u4e8b\u7269\u65e5\u5fd7\u540eGitlab\u6b63\u5e38\u91cd\u542f\uff0c\u7136\u800c\uff0c\u5728\u6211\u4eec\u7684\u670d\u52a1\u5668\u4e0a\u5220\u9664\u540e\u91cd\u542f\u4ecd\u7136\u51fa\u9519\uff1a<\/p>\n<pre>2015-05-07_07:05:33.92258 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:33.92266 LOG:  invalid primary checkpoint record\n2015-05-07_07:05:33.92280 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:33.92294 LOG:  invalid secondary checkpoint record\n2015-05-07_07:05:33.92306 PANIC:  could not locate a valid checkpoint record\n2015-05-07_07:05:33.93380 LOG:  startup process (PID 26695) was terminated by signal 6: Aborted\n2015-05-07_07:05:33.93384 LOG:  aborting startup due to startup process failure\n2015-05-07_07:05:35.12269 LOG:  database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_07:05:35.12302 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:35.12311 LOG:  invalid primary checkpoint record\n2015-05-07_07:05:35.12319 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:35.12326 LOG:  invalid secondary checkpoint record\n2015-05-07_07:05:35.12331 PANIC:  could not locate a valid checkpoint record\n2015-05-07_07:05:35.12604 LOG:  startup process (PID 26698) was terminated by signal 6: Aborted\n2015-05-07_07:05:35.12613 LOG:  aborting startup due to startup process failure\n\u00e72015-05-07_07:05:36.26036 LOG:  database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_07:05:36.26059 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:36.26068 LOG:  invalid primary checkpoint record\n2015-05-07_07:05:36.26075 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:36.26082 LOG:  invalid secondary checkpoint record\n<\/pre>\n<p>\u8fd9\u6b21\u63d0\u793a\u8bf4\u660e\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\u786e\u5b9e\u4e0d\u884c\uff0cGitlab\u62d2\u7edd\u91cd\u542f\u3002 <\/p>\n<p>\u5728\u7f51\u4e0a\u627e\u4e86\u534a\u5929\uff0c\u6700\u540e\u4f7f\u7528\u65e5\u5fd7\u91cd\u7f6e\u7b49\u547d\u4ee4\u5c06\u5176\u4fee\u597d\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a <\/p>\n<p>1. \u9996\u5148\u627e\u5230Gitlab\u4f7f\u7528\u7684\u6570\u636e\u5e93\uff1a<\/p>\n<pre>[root@localhost data]# gitlab-ctl status\nrun: logrotate: (pid 16789) 2010s; run: log: (pid 1354) 78349s\nrun: nginx: (pid 16792) 2010s; run: log: (pid 1213) 78355s\nrun: postgresql: (pid 16796) 2009s; run: log: (pid 902) 78432s\nrun: redis: (pid 16798) 2009s; run: log: (pid 608) 78497s\nrun: sidekiq: (pid 16800) 2009s; run: log: (pid 1155) 78361s\nrun: unicorn: (pid 16804) 2009s; run: log: (pid 1105) 78367s\n<\/pre>\n<p>2. \u7136\u540e\u67e5\u627epostgresql\u6240\u5728\u7684\u76ee\u5f55\uff1a<\/p>\n<pre>[root@localhost data]# ps -elf | grep  postgresql\n4 S root       890   535  0  80   0 -  1045 poll_s May06 ?        00:00:00 runsv postgresql\n4 S root       902   890  0  80   0 -  1081 poll_s May06 ?        00:00:00 svlogd -tt \/var\/log\/gitlab\/postgresql\n4 S gitlab-+ 16796   890  0  80   0 - 331484 poll_s 15:45 ?       00:00:00 \/opt\/gitlab\/embedded\/bin\/postgres -D \/var\/opt\/gitlab\/postgresql\/data\n0 S root     20240 10053  0  80   0 - 28161 pipe_w 16:18 pts\/3    00:00:00 grep --color=auto postgresql\n<\/pre>\n<p>\u770b\u5230postgresql\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u518d\/opt\/gitlab\/embedded\/bin\/postgres\u4e0b\u3002 <\/p>\n<p>3. \u5728\u76f8\u540c\u7684\u76ee\u5f55\u4e0b\u53ef\u4ee5\u627e\u5230\u53e6\u5916\u4e24\u4e2a\u547d\u4ee4\uff1a<\/p>\n<pre>pg_controldata \npg_resetxlog \n<\/pre>\n<p>4. \u8fd9\u4e24\u4e2a\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u91cd\u7f6epostgresql\u7684\u4e8b\u7269\u65e5\u5fd7\uff0c\u4e0d\u8fc7\u6211\u8fd8\u662f\u4e0d\u660e\u767d\u662f\u91cd\u5199\u65b0\u7684\u65e5\u5fd7\u8fd8\u662f\u4fee\u590d\u4e4b\u524d\u7684\u65e5\u5fd7\uff0c\u4e2a\u4eba\u89c9\u5f97\u662f\u6839\u636e\u6570\u636e\u6587\u4ef6\u6216\u8005\u5185\u5b58\u6570\u636e\u91cd\u5199\u4e8b\u7269\u65e5\u5fd7\u6587\u4ef6\u3002 <\/p>\n<p>5. \u67e5\u627eNextOID\u548cNextXID\uff1a<\/p>\n<pre>[root@localhost data]# \/opt\/gitlab\/embedded\/bin\/pg_controldata \/var\/opt\/gitlab\/postgresql\/data\/\npg_control version number:            922\nCatalog version number:               201204301\nDatabase system identifier:           6145704018498809342\nDatabase cluster state:               in production\npg_control last modified:             Thu 07 May 2015 03:50:09 PM CST\nLatest checkpoint location:           0\/20000B0\nPrior checkpoint location:            0\/2000020\nLatest checkpoint's REDO location:    0\/20000B0\nLatest checkpoint's TimeLineID:       1\nLatest checkpoint's full_page_writes: on\nLatest checkpoint's NextXID:          0\/2184\nLatest checkpoint's NextOID:          16857\nLatest checkpoint's NextMultiXactId:  1\nLatest checkpoint's NextMultiOffset:  0\nLatest checkpoint's oldestXID:        1878\nLatest checkpoint's oldestXID's DB:   16385\nLatest checkpoint's oldestActiveXID:  0\nTime of latest checkpoint:            Thu 07 May 2015 03:50:09 PM CST\nMinimum recovery ending location:     0\/0\nBackup start location:                0\/0\nBackup end location:                  0\/0\nEnd-of-backup record required:        no\nCurrent wal_level setting:            minimal\nCurrent max_connections setting:      200\nCurrent max_prepared_xacts setting:   0\nCurrent max_locks_per_xact setting:   64\nMaximum data alignment:               8\nDatabase block size:                  8192\nBlocks per segment of large relation: 131072\nWAL block size:                       8192\nBytes per WAL segment:                16777216\nMaximum length of identifiers:        64\nMaximum columns in an index:          32\nMaximum size of a TOAST chunk:        1996\nDate\/time type storage:               64-bit integers\nFloat4 argument passing:              by value\nFloat8 argument passing:              by value\n\n<\/pre>\n<p>\u4ece\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u5230\u6709\u4e2aNextOID\u548cNextXID\uff0c\u8bb0\u4e0b\u8fd9\u4e24\u4e2a\u6570\u5b57\uff0c\u4e0b\u9762\u7684\u547d\u4ee4\u91cc\u9762\u4f1a\u4f7f\u7528\u3002 <\/p>\n<p>5. \u91cd\u7f6e\u4e8b\u7269\u65e5\u5fd7\uff1a<\/p>\n<pre>[root@localhost data]# sudo -u gitlab-psql \/opt\/gitlab\/embedded\/bin\/pg_resetxlog -o 16857 -x 2184 \/var\/opt\/gitlab\/postgresql\/data\/\nTransaction log reset\n<\/pre>\n<p>\u63d0\u793a\u91cd\u7f6e\u6210\u529f\u3002\u5982\u679c\u63d0\u793a\u6570\u636e\u5e93\u88ab\u9501\uff0c\u8bf4\u660e\u6570\u636e\u5e93\u5728\u6253\u5f00\u72b6\u6001\uff0c\u5148\u5173\u95edGitlab\u540e\u91cd\u8bd5\u3002<\/p>\n<pre>gitlab-ctl stop\n<\/pre>\n<p>6. \u7136\u540e\u91cd\u542fGitlab\u5373\u53ef\u3002<\/p>\n<pre>gitlab-ctl start\n<\/pre>\n<p>\u53c2\u8003\uff1a <\/p>\n<p><a href=\"http:\/\/www.cnblogs.com\/eshizhan\/archive\/2012\/09\/23\/2699327.html\">http:\/\/www.cnblogs.com\/eshizhan\/archive\/2012\/09\/23\/2699327.html<\/a><\/p>\n<p>\u540e\u7eed\u8865\u5145\uff1a<\/p>\n<p>\u9047\u5230\u4e2a\u5f88\u5947\u602a\u7684\u95ee\u9898\uff0c\u6bcf\u6b21\u5728web\u4e0a\u90fd\u80fd\u770b\u5230\u6587\u4ef6\uff0c\u4f46\u662f\u53bbgit clone\u7684\u8bdd \u90fd\u662f\u7a7a\u9879\u76ee\uff0c\u6211\u5c1d\u8bd5\u8fc7\u5378\u8f7d\uff0c\u91cd\u88c5\uff0c\u5220\u6587\u4ef6\u90fd\u4e0d\u884c\uff0c\u91cd\u542f\u670d\u52a1\u4e5f\u4e0d\u884c\uff0c\u540e\u6765\u6000\u7591\u662f\u4e0d\u662f\u7cfb\u7edf\u7684\u95ee\u9898\uff0c \u53d1\u73b0\u91cd\u542f\u673a\u5668\u7684\u8bdd\uff0c\u5c45\u7136\u80fd\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u679c\u7136\u53ef\u4ee5\u7ba1\u7406\u9879\u76ee\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u4e00\u76f4\u5bf9git\u7684\u8d26\u53f7\u548c\u6743\u9650\u7ba1\u7406\u5f88\u662f\u5934\u5927\uff0c\u5728\u65b0\u516c\u53f8\u53d1\u73b0\u4e00\u6b3e\u8f6f\u4ef6\u5f88\u597d\u7684\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002gitlab\u4ed6\u7684\u6743\u9650\u7ba1\u7406\u548c\u7528\u6237\u7ba1\u7406\u5f88\u662f\u65b9\u4fbf\uff1a<\/p>\n<p>\u5b89\u88c5\uff1a(<a title=\"https:\/\/about.gitlab.com\/downloads\/\" href=\"https:\/\/about.gitlab.com\/downloads\/\">https:\/\/about.gitlab.com\/downloads\/<\/a>)<\/p>\n<p>Download the Omnibus package and install everything<\/p>\n<pre>curl -O https:\/\/downloads-packages.s3.amazonaws.com\/centos-6.6\/gitlab-7.6.2_omnibus.5.3.0.ci.1-1.el6.x86_64.rpm\nsudo yum install openssh-server\nsudo yum install postfix\nsudo yum install cronie\nsudo service postfix start\nsudo chkconfig postfix on\nsudo rpm -i gitlab-7.6.2_omnibus.5.3.0.ci.1-1.el6.x86_64.rpm<\/pre>\n<p>Configure and start GitLab<\/p>\n<pre><p>sudo gitlab-ctl reconfigure\nsudo lokkit -s http -s ssh&nbsp; (\u9632\u706b\u5899\u76f8\u5173\u610f\u4e49\u4e0d\u662f\u5f88\u5927)<\/p><\/pre>\n<p>\u914d\u7f6e\u76f8\u5173<\/p>\n<p>Browse to the hostname and login <br \/>Username: root <br \/>Password: 5iveL!fe <\/p>\n<p><i><\/i>For troubleshooting and configuration options please see the <a href=\"https:\/\/gitlab.com\/gitlab-org\/omnibus-gitlab\/blob\/master\/README.md\">Omnibus GitLab readme<\/a> <\/p>\n<p>\u5176\u4e2d\u4e3b\u8981\u6709\u7528\u7684\u5c31\u662f<code>gitlab-ctl \u63a7\u5236\u53f0\u3002<\/code> <\/p>\n<p><code>have fun\uff01<\/code><\/p>\n<p>gitlab\u7684\u5907\u4efd\u4e0e\u6062\u590d<\/p>\n<p><a title=\"https:\/\/gitlab.com\/gitlab-org\/gitlab-ce\/blob\/master\/doc\/raketasks\/backup_restore.md\" href=\"https:\/\/gitlab.com\/gitlab-org\/gitlab-ce\/blob\/master\/doc\/raketasks\/backup_restore.md\">https:\/\/gitlab.com\/gitlab-org\/gitlab-ce\/blob\/master\/doc\/raketasks\/backup_restore.md<\/a><\/p>\n<p>&nbsp;<\/p>\n<pre><code># use this command if you've installed GitLab with the Omnibus package\nsudo gitlab-rake gitlab:backup:create<\/code><\/pre>\n<pre><code>sudo cp 1393513186_gitlab_backup.tar \/var\/opt\/gitlab\/backups\/\n<\/code><\/pre>\n<p>Next, restore the backup by running the restore command. You need to specify the timestamp of the backup you are restoring.<\/p>\n<pre><code># Stop processes that are connected to the database\nsudo gitlab-ctl stop unicorn\nsudo gitlab-ctl stop sidekiq\n\n# This command will overwrite the contents of your GitLab database!\nsudo gitlab-rake gitlab:backup:restore BACKUP=1393513186\n\n# Start GitLab\nsudo gitlab-ctl start\n\n# Create satellites\nsudo gitlab-rake gitlab:satellites:create\n\n# Check GitLab\nsudo gitlab-rake gitlab:check SANITIZE=true<\/code><\/pre>\n<p>git \u7684rpm \u8def\u5f84<\/p>\n<p><a title=\"https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/\" href=\"https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/\">https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>git\u7684\u5347\u7ea7 \u548c\u4fee\u6539\u914d\u7f6e<\/p>\n<p>\u5907\u4efd \u6309\u4e0a\u9762\u5199\u7684\u5907\u4efd<\/p>\n<p>\u5347\u7ea7 yum -y install gitlab-ce<\/p>\n<p>\u66f4\u6539\u914d\u7f6e gitlab-ctl&nbsp; reconfigure<\/p>\n<p>\u91cd\u542f&nbsp;&nbsp; gitlab-ctl restart<\/p>\n<p>&nbsp;<\/p>\n<p>\u5947\u602a\u7684 postgresql \u95ee\u9898<\/p>\n<p><a href=\"https:\/\/www.hmouse.cn\/wp-content\/uploads\/2015\/06\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/www.hmouse.cn\/wp-content\/uploads\/2015\/06\/image_thumb6.png\" width=\"244\" height=\"41\"><\/a> <\/p>\n<p>\u4e4b\u524d\u4e00\u6b21\u5f02\u5e38\uff0c\u7136\u540egitlab \u4e00\u76f4\u65e0\u6cd5\u8bbf\u95ee\uff0c\u540e\u6765\u6392\u67e5\u5230\u662fpostgresql \u7684\u95ee\u9898\u3002\u4ece\u65e5\u5fd7\u4e2d\u53d1\u73b0postgresql \u7684\u62a5\u9519\u662f\u4e0b\u9762\u3002\u4e4b\u524d\u4e00\u76f4\u4ee5\u4e3a\u662f\u8fdb\u7a0b\u7684\u539f\u56e0\uff0c\u540e\u6765\u624d\u53d1\u73b0\u771f\u7684\u662f\u6743\u9650\u7684\u95ee\u9898\uff0c\u5982\u679c\u628a\/tmp\u7684\u6743\u9650\u8bbe\u7f6e\u4e3a777\uff0c\u95ee\u9898\u89e3\u51b3\u3002\u4f46\u662f\u6211\u4ece\u5176\u4ed6\u673a\u5668\u53d1\u73b0\u90fd\u662f777\u6743\u9650\uff0c\u5f88\u5947\u602a\u4e3a\u4ec0\u4e48\u4e0d\u884c\u3002<\/p>\n<p><font color=\"#ff0000\">\u540e\u6765\u786e\u8ba4\u662f\u670d\u52a1\u5668\u7684\u95ee\u9898 tmp\u7684\u76ee\u5f55 \u5c5e\u4e3b\u90fd\u4e0d\u662froot\u4e86<\/font><\/p>\n<p>&nbsp;<\/p>\n<p>su &#8211; gitlab-psql <\/p>\n<p>-sh-4.1$ \/opt\/gitlab\/embedded\/bin\/postgres -D \/var\/opt\/gitlab\/postgresql\/data<br \/>FATAL:&nbsp; lock file &#8220;postmaster.pid&#8221; already exists<br \/>HINT:&nbsp; Is another postmaster (PID 31417) running in data directory &#8220;\/var\/opt\/gitlab\/postgresql\/data&#8221;? <\/p>\n<p>\u8fd9\u6837\u53ef\u4ee5\u5355\u542f\u52a8postgresql \u7684\u3002<\/p>\n<p>\u95ee\u9898\u89e3\u51b3\uff0c\u540e\u6765\u53d1\u73b0\u4e00\u4e2a\u6bd4\u8f83\u597d\u7684\u6587\u7ae0\uff1a<\/p>\n<p><a title=\"http:\/\/cloudate.net\/?p=1352\" href=\"http:\/\/cloudate.net\/?p=1352\">http:\/\/cloudate.net\/?p=1352<\/a>&nbsp; \u662f\u5904\u7406\u4e8b\u52a1\u65e5\u5fd7\u7684\u95ee\u9898\u3002\u7559\u4f5c\u5907\u7528<\/p>\n<h3>Postgresql(Gitlab)\u4fee\u6539\u4e86\u4e8b\u7269\u65e5\u5fd7\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8<\/h3>\n<p>\u4eca\u5929\u4e00\u4e2a\u540c\u4e8b\u4fee\u6539\u4e86Gitlab\u4e2dPostgresql\u7684\u4e8b\u7269\u65e5\u5fd7\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8\uff0c\u65e5\u5fd7\u8def\u5f84\u5982\u4e0b\uff1a<\/p>\n<pre>\/var\/opt\/gitlab\/postgresql\/data\/pg_xlog\/0000000100000000000000001\n<\/pre>\n<p>\u542f\u52a8gitlab\u62a5\u9519:<\/p>\n<pre>2015-05-07_06:57:31.44580 LOG: startup process (PID 24323) was terminated by signal 6: Aborted\n2015-05-07_06:57:31.44584 LOG: aborting startup due to startup process failure\n2015-05-07_06:57:32.57551 LOG: database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_06:57:32.57616 LOG: invalid magic number 209F in log file 0, segment 1, offset 13164544\n2015-05-07_06:57:32.57626 LOG: invalid primary checkpoint record\n2015-05-07_06:57:32.57633 LOG: invalid secondary checkpoint record\n2015-05-07_06:57:32.57637 PANIC: could not locate a valid checkpoint record\n2015-05-07_06:57:32.58162 LOG: startup process (PID 24328) was terminated by signal 6: Aborted\n2015-05-07_06:57:32.58165 LOG: aborting startup due to startup process failure\n2015-05-07_06:57:33.71350 LOG: database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_06:57:33.71406 LOG: invalid magic number 209F in log file 0, segment 1, offset 13164544\n2015-05-07_06:57:33.71422 LOG: invalid primary checkpoint record\n2015-05-07_06:57:33.71440 LOG: invalid secondary checkpoint record\n2015-05-07_06:57:33.71452 PANIC: could not locate a valid checkpoint record\n2015-05-07_06:57:33.71862 LOG: startup process (PID 24333) was terminated by signal 6: Aborted\n2015-05-07_06:57:33.71865 LOG: aborting startup due to startup process failure\n2015-05-07_06:57:34.83445 LOG: database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_06:57:34.83475 LOG: invalid magic number 209F in log file 0, segment 1, offset 13164544\n2015-05-07_06:57:34.83484 LOG: invalid primary checkpoint record\n2015-05-07_06:57:34.83490 LOG: invalid secondary checkpoint record\n<\/pre>\n<p>\u53ef\u89c1\uff0c\u4e8b\u7269\u65e5\u5fd7\u683c\u5f0f\u88ab\u6bc1\u574f\uff0c\u6240\u4ee5\uff0c\u627e\u4e0d\u5230\u9b54\u6570\u3002\u6211\u5f00\u59cb\u8ba4\u4e3a\u4e8b\u7269\u65e5\u5fd7\u4e0d\u662f\u5fc5\u987b\u7684\u6570\u636e\u65e5\u5fd7\uff0c\u9996\u5148\u5c1d\u8bd5\u4e86\u5220\u9664\u64cd\u4f5c\uff0c\u800c\u4e14\u5728\u6211\u7684\u4e2a\u4eba\u7535\u8111\u7684Gitlab\u4e0a\u505a\u4e86\u5c1d\u8bd5\uff0c\u5220\u9664\u4e8b\u7269\u65e5\u5fd7\u540eGitlab\u6b63\u5e38\u91cd\u542f\uff0c\u7136\u800c\uff0c\u5728\u6211\u4eec\u7684\u670d\u52a1\u5668\u4e0a\u5220\u9664\u540e\u91cd\u542f\u4ecd\u7136\u51fa\u9519\uff1a<\/p>\n<pre>2015-05-07_07:05:33.92258 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:33.92266 LOG:  invalid primary checkpoint record\n2015-05-07_07:05:33.92280 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:33.92294 LOG:  invalid secondary checkpoint record\n2015-05-07_07:05:33.92306 PANIC:  could not locate a valid checkpoint record\n2015-05-07_07:05:33.93380 LOG:  startup process (PID 26695) was terminated by signal 6: Aborted\n2015-05-07_07:05:33.93384 LOG:  aborting startup due to startup process failure\n2015-05-07_07:05:35.12269 LOG:  database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_07:05:35.12302 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:35.12311 LOG:  invalid primary checkpoint record\n2015-05-07_07:05:35.12319 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:35.12326 LOG:  invalid secondary checkpoint record\n2015-05-07_07:05:35.12331 PANIC:  could not locate a valid checkpoint record\n2015-05-07_07:05:35.12604 LOG:  startup process (PID 26698) was terminated by signal 6: Aborted\n2015-05-07_07:05:35.12613 LOG:  aborting startup due to startup process failure\n\u00e72015-05-07_07:05:36.26036 LOG:  database system was shut down at 2015-05-07 06:01:13 GMT\n2015-05-07_07:05:36.26059 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:36.26068 LOG:  invalid primary checkpoint record\n2015-05-07_07:05:36.26075 LOG:  could not open file \"pg_xlog\/000000010000000000000001\" (log file 0, segment 1): No such file or directory\n2015-05-07_07:05:36.26082 LOG:  invalid secondary checkpoint record\n<\/pre>\n<p>\u8fd9\u6b21\u63d0\u793a\u8bf4\u660e\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\u786e\u5b9e\u4e0d\u884c\uff0cGitlab\u62d2\u7edd\u91cd\u542f\u3002 <\/p>\n<p>\u5728\u7f51\u4e0a\u627e\u4e86\u534a\u5929\uff0c\u6700\u540e\u4f7f\u7528\u65e5\u5fd7\u91cd\u7f6e\u7b49\u547d\u4ee4\u5c06\u5176\u4fee\u597d\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a <\/p>\n<p>1. \u9996\u5148\u627e\u5230Gitlab\u4f7f\u7528\u7684\u6570\u636e\u5e93\uff1a<\/p>\n<pre>[root@localhost data]# gitlab-ctl status\nrun: logrotate: (pid 16789) 2010s; run: log: (pid 1354) 78349s\nrun: nginx: (pid 16792) 2010s; run: log: (pid 1213) 78355s\nrun: postgresql: (pid 16796) 2009s; run: log: (pid 902) 78432s\nrun: redis: (pid 16798) 2009s; run: log: (pid 608) 78497s\nrun: sidekiq: (pid 16800) 2009s; run: log: (pid 1155) 78361s\nrun: unicorn: (pid 16804) 2009s; run: log: (pid 1105) 78367s\n<\/pre>\n<p>2. \u7136\u540e\u67e5\u627epostgresql\u6240\u5728\u7684\u76ee\u5f55\uff1a<\/p>\n<pre>[root@localhost data]# ps -elf | grep  postgresql\n4 S root       890   535  0  80   0 -  1045 poll_s May06 ?        00:00:00 runsv postgresql\n4 S root       902   890  0  80   0 -  1081 poll_s May06 ?        00:00:00 svlogd -tt \/var\/log\/gitlab\/postgresql\n4 S gitlab-+ 16796   890  0  80   0 - 331484 poll_s 15:45 ?       00:00:00 \/opt\/gitlab\/embedded\/bin\/postgres -D \/var\/opt\/gitlab\/postgresql\/data\n0 S root     20240 10053  0  80   0 - 28161 pipe_w 16:18 pts\/3    00:00:00 grep --color=auto postgresql\n<\/pre>\n<p>\u770b\u5230postgresql\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u518d\/opt\/gitlab\/embedded\/bin\/postgres\u4e0b\u3002 <\/p>\n<p>3. \u5728\u76f8\u540c\u7684\u76ee\u5f55\u4e0b\u53ef\u4ee5\u627e\u5230\u53e6\u5916\u4e24\u4e2a\u547d\u4ee4\uff1a<\/p>\n<pre>pg_controldata \npg_resetxlog \n<\/pre>\n<p>4. \u8fd9\u4e24\u4e2a\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u91cd\u7f6epostgresql\u7684\u4e8b\u7269\u65e5\u5fd7\uff0c\u4e0d\u8fc7\u6211\u8fd8\u662f\u4e0d\u660e\u767d\u662f\u91cd\u5199\u65b0\u7684\u65e5\u5fd7\u8fd8\u662f\u4fee\u590d\u4e4b\u524d\u7684\u65e5\u5fd7\uff0c\u4e2a\u4eba\u89c9\u5f97\u662f\u6839\u636e\u6570\u636e\u6587\u4ef6\u6216\u8005\u5185\u5b58\u6570\u636e\u91cd\u5199\u4e8b\u7269\u65e5\u5fd7\u6587\u4ef6\u3002 <\/p>\n<p>5. \u67e5\u627eNextOID\u548cNextXID\uff1a<\/p>\n<pre>[root@localhost data]# \/opt\/gitlab\/embedded\/bin\/pg_controldata \/var\/opt\/gitlab\/postgresql\/data\/\npg_control version number:            922\nCatalog version number:               201204301\nDatabase system identifier:           6145704018498809342\nDatabase cluster state:               in production\npg_control last modified:             Thu 07 May 2015 03:50:09 PM CST\nLatest checkpoint location:           0\/20000B0\nPrior checkpoint location:            0\/2000020\nLatest checkpoint's REDO location:    0\/20000B0\nLatest checkpoint's TimeLineID:       1\nLatest checkpoint's full_page_writes: on\nLatest checkpoint's NextXID:          0\/2184\nLatest checkpoint's NextOID:          16857\nLatest checkpoint's NextMultiXactId:  1\nLatest checkpoint's NextMultiOffset:  0\nLatest checkpoint's oldestXID:        1878\nLatest checkpoint's oldestXID's DB:   16385\nLatest checkpoint's oldestActiveXID:  0\nTime of latest checkpoint:            Thu 07 May 2015 03:50:09 PM CST\nMinimum recovery ending location:     0\/0\nBackup start location:                0\/0\nBackup end location:                  0\/0\nEnd-of-backup record required:        no\nCurrent wal_level setting:            minimal\nCurrent max_connections setting:      200\nCurrent max_prepared_xacts setting:   0\nCurrent max_locks_per_xact setting:   64\nMaximum data alignment:               8\nDatabase block size:                  8192\nBlocks per segment of large relation: 131072\nWAL block size:                       8192\nBytes per WAL segment:                16777216\nMaximum length of identifiers:        64\nMaximum columns in an index:          32\nMaximum size of a TOAST chunk:        1996\nDate\/time type storage:               64-bit integers\nFloat4 argument passing:              by value\nFloat8 argument passing:              by value\n\n<\/pre>\n<p>\u4ece\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u5230\u6709\u4e2aNextOID\u548cNextXID\uff0c\u8bb0\u4e0b\u8fd9\u4e24\u4e2a\u6570\u5b57\uff0c\u4e0b\u9762\u7684\u547d\u4ee4\u91cc\u9762\u4f1a\u4f7f\u7528\u3002 <\/p>\n<p>5. \u91cd\u7f6e\u4e8b\u7269\u65e5\u5fd7\uff1a<\/p>\n<pre>[root@localhost data]# sudo -u gitlab-psql \/opt\/gitlab\/embedded\/bin\/pg_resetxlog -o 16857 -x 2184 \/var\/opt\/gitlab\/postgresql\/data\/\nTransaction log reset\n<\/pre>\n<p>\u63d0\u793a\u91cd\u7f6e\u6210\u529f\u3002\u5982\u679c\u63d0\u793a\u6570\u636e\u5e93\u88ab\u9501\uff0c\u8bf4\u660e\u6570\u636e\u5e93\u5728\u6253\u5f00\u72b6\u6001\uff0c\u5148\u5173\u95edGitlab\u540e\u91cd\u8bd5\u3002<\/p>\n<pre>gitlab-ctl stop\n<\/pre>\n<p>6. \u7136\u540e\u91cd\u542fGitlab\u5373\u53ef\u3002<\/p>\n<pre>gitlab-ctl start\n<\/pre>\n<p>\u53c2\u8003\uff1a <\/p>\n<p><a href=\"http:\/\/www.cnblogs.com\/eshizhan\/archive\/2012\/09\/23\/2699327.html\">http:\/\/www.cnblogs.com\/eshizhan\/archive\/2012\/09\/23\/2699327.html<\/a><\/p>\n<p>\u540e\u7eed\u8865\u5145\uff1a<\/p>\n<p>\u9047\u5230\u4e2a\u5f88\u5947\u602a\u7684\u95ee\u9898\uff0c\u6bcf\u6b21\u5728web\u4e0a\u90fd\u80fd\u770b\u5230\u6587\u4ef6\uff0c\u4f46\u662f\u53bbgit clone\u7684\u8bdd \u90fd\u662f\u7a7a\u9879\u76ee\uff0c\u6211\u5c1d\u8bd5\u8fc7\u5378\u8f7d\uff0c\u91cd\u88c5\uff0c\u5220\u6587\u4ef6\u90fd\u4e0d\u884c\uff0c\u91cd\u542f\u670d\u52a1\u4e5f\u4e0d\u884c\uff0c\u540e\u6765\u6000\u7591\u662f\u4e0d\u662f\u7cfb\u7edf\u7684\u95ee\u9898\uff0c \u53d1\u73b0\u91cd\u542f\u673a\u5668\u7684\u8bdd\uff0c\u5c45\u7136\u80fd\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u679c\u7136\u53ef\u4ee5\u7ba1\u7406\u9879\u76ee\u4e86\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[68],"class_list":["post-4263","post","type-post","status-publish","format-standard","hentry","category-5","tag-gitlab","category-5-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts\/4263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4263"}],"version-history":[{"count":8,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts\/4263\/revisions"}],"predecessor-version":[{"id":4721,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=\/wp\/v2\/posts\/4263\/revisions\/4721"}],"wp:attachment":[{"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hmouse.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}