2014-06-13 5 views
1

재부팅 후 Mac에서 10.9.3 postgresql 9.2를 다시 시작할 수 없습니다.Mac에서 재부팅 후 postgresql을 실행하지 못했습니다. (재부팅 후)

$ initdb -D /usr/local/var/postgres 
The files belonging to this database system will be owned by user "alex". 
This user must also own the server process. 

The database cluster will be initialized with locale "en_US.UTF-8". 
The default database encoding has accordingly been set to "UTF8". 
The default text search configuration will be set to "english". 

Data page checksums are disabled. 

initdb: directory "/usr/local/var/postgres" exists but is not empty 
If you want to create a new database system, either remove or empty 
the directory "/usr/local/var/postgres" or run initdb 
with an argument other than "/usr/local/var/postgres" 

나는 다른 디렉토리를 만들어야한다고 결정했습니다. 그래서 거기서 데이터 디렉토리를 만들고 initdb를 다시 실행했습니다 :

$ initdb -D /usr/local/var/postgres/data 
The files belonging to this database system will be owned by user "alex". 
This user must also own the server process. 

The database cluster will be initialized with locale "en_US.UTF-8". 
The default database encoding has accordingly been set to "UTF8". 
The default text search configuration will be set to "english". 

Data page checksums are disabled. 

fixing permissions on existing directory /usr/local/var/postgres/data ... initdb: 
    could not change permissions of directory "/usr/local/var/postgres/data": 
    Operation not permitted 

권한을 변경하려했지만 올바른 것이 무엇인지 알지 못했습니다. 다음은 내가 가지고있는 것입니다.

$ ls -ald /usr/local/var/postgres 
drwxr-xr-x 22 _postgres staff 748 Jun 13 17:26 /usr/local/var/postgres 

ls -ald /usr/local/var/postgres/data 
drwxr-xr-x 2 _postgres staff 68 Jun 13 17:26 /usr/local/var/postgres/data 


$ ls -al /usr/local/var/postgres 
total 96 
drwxr-xr-x 22 _postgres staff  748 Jun 13 17:26 . 
drwx------ 3 alex  admin  102 Jun 1 15:08 .. 
-rw------- 1 _postgres _postgres  4 Jun 1 15:08 PG_VERSION 
drwx------ 6 _postgres _postgres 204 Jun 2 11:40 base 
drwxr-xr-x 2 _postgres staff   68 Jun 13 17:26 data 
drwx------ 42 _postgres _postgres 1428 Jun 2 14:18 global 
drwx------ 3 _postgres _postgres 102 Jun 1 15:08 pg_clog 
-rw------- 1 _postgres _postgres 4465 Jun 2 10:58 pg_hba.conf 
-rw------- 1 _postgres _postgres 1636 Jun 1 15:08 pg_ident.conf 
drwx------ 4 _postgres _postgres 136 Jun 1 15:08 pg_multixact 
drwx------ 3 _postgres _postgres 102 Jun 1 18:24 pg_notify 
drwx------ 2 _postgres _postgres  68 Jun 1 15:08 pg_serial 
drwx------ 2 _postgres _postgres  68 Jun 1 15:08 pg_snapshots 
drwx------ 7 _postgres _postgres 238 Jun 2 21:23 pg_stat 
drwx------ 2 _postgres _postgres  68 Jun 2 21:23 pg_stat_tmp 
drwx------ 3 _postgres _postgres 102 Jun 1 15:08 pg_subtrans 
drwx------ 2 _postgres _postgres  68 Jun 1 15:08 pg_tblspc 
drwx------ 2 _postgres _postgres  68 Jun 1 15:08 pg_twophase 
drwx------ 4 _postgres _postgres 136 Jun 1 15:08 pg_xlog 
-rw------- 1 _postgres _postgres 20571 Jun 1 15:08 postgresql.conf 
-rw------- 1 _postgres _postgres  79 Jun 1 18:24 postmaster.opts 
-rw------- 1 _postgres _postgres 1482 Jun 2 21:23 server.log 

다음에해야 할 일은 무엇입니까? 나는 아이디어가 없어. 유일한 추측은 파일 또는 폴더 사용 권한과 관련이 있다는 것입니다.

+0

을 '태그 이유, 그것은 처음부터 데이터 디렉토리를 만들어 볼 수 없습니다. 이미 존재하면 이전 데이터를 지우는 것에 대한 보호 수단으로 실패합니다. –

+0

postgres가 시작되지 않으면 그 이유를 알려주는 오류 메시지가 표시됩니다. 이 메시지를 읽고 싶습니다. –

답변

0

두 단계 프로세스 :

  1. 귀하의 웹 브라우저로 이동 "PostgreSQL의 권한 데이터 디렉토리"를 검색 - 공식 매뉴얼 (그것은 나를위한 최고 하나)에서 페이지 목록을 아래로 본다.
  2. page from the official manuals을 읽고 지침을 따르십시오.

"_postgres"사용자로 실행하지 않기 때문에 "사용 권한을 변경할 수 없습니다"라는 메시지가 표시됩니다. 참고 - 일반적으로 사용자 "postgres"입니다. 나는 이름 변경이 당신이했거나 Mac 설치에서 공통적 인 것이 었는지 모르겠습니다.

아 - 내가이 포스트 그레스을 시작하지 않습니다 initdb` "리눅스"

+0

확인해 보겠습니다. Mac Ox 특정 문제가 아니기 때문에 Linux입니다. –

+0

리눅스에서는 아마도 패키지 기반의 것을 사용할 것입니다. 예를 들어, 데비안에는 다중 설치 버전 래퍼'pg-createcluster'가 있습니다. –

+0

문서의이 페이지는 http://www.postgresql.org/docs/current/static/creating-cluster.html을 해결합니다. –