1 |
Longer answer (as promised) |
2 |
|
3 |
On Saturday, May 21, 2016 04:56:18 PM waltdnes@××××××××.org wrote: |
4 |
> On Sat, May 21, 2016 at 08:55:39AM +0200, J. Roeleveld wrote |
5 |
|
6 |
> > Did you run |
7 |
> > emerge --config dev-db/postgresql:9.5 |
8 |
> |
9 |
> Yes. |
10 |
> |
11 |
> > succesfully? |
12 |
> |
13 |
> Obviously not. |
14 |
|
15 |
:) |
16 |
|
17 |
> I think I've finally figured it out. I edited |
18 |
> /etc/conf.d/postgresql-9.5 to PG_INITDB_OPTS="--encoding=UTF8" and ran |
19 |
> "emerge --config dev-db/postgresql:9.5". I got an error message about |
20 |
> the data directory not be empty (probably from my first attempt). I ran |
21 |
> |
22 |
> rm /var/lib/postgresql/9.5/data/* |
23 |
> emerge --config dev-db/postgresql:9.5 |
24 |
> |
25 |
> and got a bit further. I did get error messages as follows |
26 |
> |
27 |
> |
28 |
> ####################################################################### |
29 |
> The database cluster will be initialized with locale "en_US.iso88591". |
30 |
> initdb: encoding mismatch |
31 |
> The encoding you selected (UTF8) and the encoding that the |
32 |
> selected locale uses (LATIN1) do not match. This would lead to |
33 |
> misbehavior in various character string processing functions. |
34 |
> Rerun initdb and either do not specify an encoding explicitly, |
35 |
> or choose a matching combination. |
36 |
> mv: cannot stat '/var/lib/postgresql/9.5/data/pg_hba.conf': No such file or |
37 |
> directory mv: cannot stat '/var/lib/postgresql/9.5/data/pg_ident.conf': No |
38 |
> such file or directory mv: cannot stat |
39 |
> '/var/lib/postgresql/9.5/data/postgresql.conf': No such file or directory |
40 |
> ####################################################################### |
41 |
|
42 |
If there is a mismatch, the config-script refuses to work correctly. |
43 |
|
44 |
> I fixed that. In /etc/conf.d/postgresql-9.5 I set |
45 |
> PG_INITDB_OPTS="--encoding=iso88591" and ran |
46 |
> |
47 |
> rm /var/lib/postgresql/9.5/data/* |
48 |
> emerge --config dev-db/postgresql:9.5 |
49 |
> |
50 |
> and got the following. Does it look OK? Do I understand correctly... |
51 |
> |
52 |
> config files are located in /etc/postgresql-9.5/ |
53 |
> the actual databases are located in /var/lib/postgresql/9.5/data |
54 |
> |
55 |
> ####################################################################### |
56 |
|
57 |
<snipped output - which looks ok> |
58 |
|
59 |
> |
60 |
> WARNING: enabling "trust" authentication for local connections |
61 |
> You can change this by editing pg_hba.conf or using the option -A, or |
62 |
> --auth-local and --auth-host, the next time you run initdb. |
63 |
|
64 |
This is nothing to worry about, as long as the database is not accessible from |
65 |
outside. |
66 |
The "trust" part means it ignores passwords. By default, this is only for |
67 |
"localhost" |
68 |
|
69 |
> Success. You can now start the database server using: |
70 |
> |
71 |
> /usr/lib64/postgresql-9.5/bin/pg_ctl -D /var/lib/postgresql/9.5/data -l |
72 |
> logfile start |
73 |
|
74 |
Ignore this line. |
75 |
|
76 |
> * The autovacuum function, which was in contrib, has been moved to the main |
77 |
> * PostgreSQL functions starting with 8.1, and starting with 8.4 is now |
78 |
> enabled * by default. You can disable it in the cluster's: |
79 |
> * /etc/postgresql-9.5/postgresql.conf |
80 |
> * |
81 |
> * The PostgreSQL server, by default, will log events to: |
82 |
> * /var/lib/postgresql/9.5/data/postmaster.log |
83 |
> * |
84 |
> * You should use the '/etc/init.d/postgresql-9.5' script to run PostgreSQL |
85 |
> * instead of 'pg_ctl'. |
86 |
|
87 |
Listen to this line :) |
88 |
The init-script uses "pg_ctl" to start/stop postgresql. |
89 |
|
90 |
> ####################################################################### |
91 |
> |
92 |
> There's still one apparent internal contradiction in the output... |
93 |
> |
94 |
> ####################################################################### |
95 |
> Success. You can now start the database server using: |
96 |
> |
97 |
> /usr/lib64/postgresql-9.5/bin/pg_ctl -D /var/lib/postgresql/9.5/data -l |
98 |
> logfile start |
99 |
> ####################################################################### |
100 |
> |
101 |
> ...but it also says... |
102 |
> |
103 |
> ####################################################################### |
104 |
> * You should use the '/etc/init.d/postgresql-9.5' script to run PostgreSQL |
105 |
> * instead of 'pg_ctl'. |
106 |
> ####################################################################### |
107 |
|
108 |
See above, use the init-script and you're fine. |
109 |
|
110 |
If you change the configuration, you can tell Postgresql to reload the new |
111 |
config by issuing " /etc/init.d/postgresql-9.5 reload " |
112 |
|
113 |
Most common config-changes to a running system: adding/removing users/access to |
114 |
/etc/postgresql-9.5/pg_hba.conf. |
115 |
|
116 |
One additional piece of info, by default, it logs to |
117 |
/var/lib/postgresql/9.5/data/postmaster.log |
118 |
|
119 |
If you want it to log to a different location or to syslog, you can edit this |
120 |
in the file: |
121 |
/etc/postgresql-9.5/postgresql.conf |
122 |
|
123 |
Look for the section: |
124 |
#------------------------------------------------------------------------------ |
125 |
# ERROR REPORTING AND LOGGING |
126 |
#------------------------------------------------------------------------------ |
127 |
|
128 |
The comments in the file tell you which settings require a restart (of |
129 |
postgresql). The ones that don't should come into effect with just the |
130 |
"reload" command I mentioned above. |
131 |
|
132 |
-- |
133 |
Joost |