how to update postgres.conf path after relocating it from data directory
I'm installing a Postgresql-9.4 HA
environment in RHEL 7
, when I initialize postgres db - it creates a data directory and within the data directory goes postgresql.conf
& pg_hba.conf
files. Here, I anticipate the creation of config files in data directory creates a collision, as it gets overridden during the master replication.
So, I'm trying to relocate the postgres.conf
and pg_hba.conf
files from the data directory and make postgres service
to use the relocated config files. Where do I updated the path of the config files?
Update: I've updated the PGDATA in /usr/lib/systemd/system/postgresql-9.4.service
to point the relocated conf files. In the new postgres.conf file, updated data directory and hba_file paths. And I tried to restart the service, then it returns an error
Job for postgresql-9.4.service failed. See 'systemctl status postgresql-9.4.service' and 'journalctl -xn' for details.
rhel configuration postgresql
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I'm installing a Postgresql-9.4 HA
environment in RHEL 7
, when I initialize postgres db - it creates a data directory and within the data directory goes postgresql.conf
& pg_hba.conf
files. Here, I anticipate the creation of config files in data directory creates a collision, as it gets overridden during the master replication.
So, I'm trying to relocate the postgres.conf
and pg_hba.conf
files from the data directory and make postgres service
to use the relocated config files. Where do I updated the path of the config files?
Update: I've updated the PGDATA in /usr/lib/systemd/system/postgresql-9.4.service
to point the relocated conf files. In the new postgres.conf file, updated data directory and hba_file paths. And I tried to restart the service, then it returns an error
Job for postgresql-9.4.service failed. See 'systemctl status postgresql-9.4.service' and 'journalctl -xn' for details.
rhel configuration postgresql
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
did you see this page (·:
– lese
Oct 15 '15 at 19:30
add a comment |
I'm installing a Postgresql-9.4 HA
environment in RHEL 7
, when I initialize postgres db - it creates a data directory and within the data directory goes postgresql.conf
& pg_hba.conf
files. Here, I anticipate the creation of config files in data directory creates a collision, as it gets overridden during the master replication.
So, I'm trying to relocate the postgres.conf
and pg_hba.conf
files from the data directory and make postgres service
to use the relocated config files. Where do I updated the path of the config files?
Update: I've updated the PGDATA in /usr/lib/systemd/system/postgresql-9.4.service
to point the relocated conf files. In the new postgres.conf file, updated data directory and hba_file paths. And I tried to restart the service, then it returns an error
Job for postgresql-9.4.service failed. See 'systemctl status postgresql-9.4.service' and 'journalctl -xn' for details.
rhel configuration postgresql
I'm installing a Postgresql-9.4 HA
environment in RHEL 7
, when I initialize postgres db - it creates a data directory and within the data directory goes postgresql.conf
& pg_hba.conf
files. Here, I anticipate the creation of config files in data directory creates a collision, as it gets overridden during the master replication.
So, I'm trying to relocate the postgres.conf
and pg_hba.conf
files from the data directory and make postgres service
to use the relocated config files. Where do I updated the path of the config files?
Update: I've updated the PGDATA in /usr/lib/systemd/system/postgresql-9.4.service
to point the relocated conf files. In the new postgres.conf file, updated data directory and hba_file paths. And I tried to restart the service, then it returns an error
Job for postgresql-9.4.service failed. See 'systemctl status postgresql-9.4.service' and 'journalctl -xn' for details.
rhel configuration postgresql
rhel configuration postgresql
edited Oct 15 '15 at 20:21
GIRI
asked Oct 15 '15 at 19:17
GIRIGIRI
2803614
2803614
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
did you see this page (·:
– lese
Oct 15 '15 at 19:30
add a comment |
1
did you see this page (·:
– lese
Oct 15 '15 at 19:30
1
1
did you see this page (·:
– lese
Oct 15 '15 at 19:30
did you see this page (·:
– lese
Oct 15 '15 at 19:30
add a comment |
1 Answer
1
active
oldest
votes
I've found this page in Postgresql official website, in detail :
If you wish to keep the configuration files elsewhere than the data
directory, the postgres -D command-line option or PGDATA environment
variable must point to the directory containing the configuration
files, and the data_directory parameter must be set in postgresql.conf
(or on the command line) to show where the data directory is actually
located. Notice that data_directory overrides -D and PGDATA for the
location of the data directory, but not for the location of the
configuration files.
If you wish, you can specify the configuration file names and
locations individually using the parameters config_file, hba_file
and/or ident_file. config_file can only be specified on the postgres
command line, but the others can be set within the main configuration
file. If all three parameters plus data_directory are explicitly set,
then it is not necessary to specify -D or PGDATA.
When setting any of these parameters, a relative path will be
interpreted with respect to the directory in which postgres is
started.
What's the output of echo $PGDATA
on your host?
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Does echo$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files/usr/lib/systemd/system/postgresql-9.3.service
and/etc/systemd/system/postgresql-9.3.service
and reloaded the service.
– lese
Oct 19 '15 at 18:52
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f236478%2fhow-to-update-postgres-conf-path-after-relocating-it-from-data-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've found this page in Postgresql official website, in detail :
If you wish to keep the configuration files elsewhere than the data
directory, the postgres -D command-line option or PGDATA environment
variable must point to the directory containing the configuration
files, and the data_directory parameter must be set in postgresql.conf
(or on the command line) to show where the data directory is actually
located. Notice that data_directory overrides -D and PGDATA for the
location of the data directory, but not for the location of the
configuration files.
If you wish, you can specify the configuration file names and
locations individually using the parameters config_file, hba_file
and/or ident_file. config_file can only be specified on the postgres
command line, but the others can be set within the main configuration
file. If all three parameters plus data_directory are explicitly set,
then it is not necessary to specify -D or PGDATA.
When setting any of these parameters, a relative path will be
interpreted with respect to the directory in which postgres is
started.
What's the output of echo $PGDATA
on your host?
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Does echo$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files/usr/lib/systemd/system/postgresql-9.3.service
and/etc/systemd/system/postgresql-9.3.service
and reloaded the service.
– lese
Oct 19 '15 at 18:52
add a comment |
I've found this page in Postgresql official website, in detail :
If you wish to keep the configuration files elsewhere than the data
directory, the postgres -D command-line option or PGDATA environment
variable must point to the directory containing the configuration
files, and the data_directory parameter must be set in postgresql.conf
(or on the command line) to show where the data directory is actually
located. Notice that data_directory overrides -D and PGDATA for the
location of the data directory, but not for the location of the
configuration files.
If you wish, you can specify the configuration file names and
locations individually using the parameters config_file, hba_file
and/or ident_file. config_file can only be specified on the postgres
command line, but the others can be set within the main configuration
file. If all three parameters plus data_directory are explicitly set,
then it is not necessary to specify -D or PGDATA.
When setting any of these parameters, a relative path will be
interpreted with respect to the directory in which postgres is
started.
What's the output of echo $PGDATA
on your host?
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Does echo$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files/usr/lib/systemd/system/postgresql-9.3.service
and/etc/systemd/system/postgresql-9.3.service
and reloaded the service.
– lese
Oct 19 '15 at 18:52
add a comment |
I've found this page in Postgresql official website, in detail :
If you wish to keep the configuration files elsewhere than the data
directory, the postgres -D command-line option or PGDATA environment
variable must point to the directory containing the configuration
files, and the data_directory parameter must be set in postgresql.conf
(or on the command line) to show where the data directory is actually
located. Notice that data_directory overrides -D and PGDATA for the
location of the data directory, but not for the location of the
configuration files.
If you wish, you can specify the configuration file names and
locations individually using the parameters config_file, hba_file
and/or ident_file. config_file can only be specified on the postgres
command line, but the others can be set within the main configuration
file. If all three parameters plus data_directory are explicitly set,
then it is not necessary to specify -D or PGDATA.
When setting any of these parameters, a relative path will be
interpreted with respect to the directory in which postgres is
started.
What's the output of echo $PGDATA
on your host?
I've found this page in Postgresql official website, in detail :
If you wish to keep the configuration files elsewhere than the data
directory, the postgres -D command-line option or PGDATA environment
variable must point to the directory containing the configuration
files, and the data_directory parameter must be set in postgresql.conf
(or on the command line) to show where the data directory is actually
located. Notice that data_directory overrides -D and PGDATA for the
location of the data directory, but not for the location of the
configuration files.
If you wish, you can specify the configuration file names and
locations individually using the parameters config_file, hba_file
and/or ident_file. config_file can only be specified on the postgres
command line, but the others can be set within the main configuration
file. If all three parameters plus data_directory are explicitly set,
then it is not necessary to specify -D or PGDATA.
When setting any of these parameters, a relative path will be
interpreted with respect to the directory in which postgres is
started.
What's the output of echo $PGDATA
on your host?
edited Oct 15 '15 at 19:36
answered Oct 15 '15 at 19:27
leselese
2,13331327
2,13331327
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Does echo$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files/usr/lib/systemd/system/postgresql-9.3.service
and/etc/systemd/system/postgresql-9.3.service
and reloaded the service.
– lese
Oct 19 '15 at 18:52
add a comment |
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Does echo$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files/usr/lib/systemd/system/postgresql-9.3.service
and/etc/systemd/system/postgresql-9.3.service
and reloaded the service.
– lese
Oct 19 '15 at 18:52
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
I've updated my post (following the instructions) echo $PGDATA shows empty line,
– GIRI
Oct 15 '15 at 20:22
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Check if this post can help, right now I can't test unfortunately
– lese
Oct 15 '15 at 20:30
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Yeah, I've updated the data directory location. But when tried to start the postgresql, the logs says, there is no such directory. I modified the permissions to postgres user and rebooted the system, which is of no use. It returns the same error.
– GIRI
Oct 19 '15 at 17:43
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Looked into the post, it only specifies the location of the postgresql-9.4.service file.
– GIRI
Oct 19 '15 at 17:44
Does echo
$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files /usr/lib/systemd/system/postgresql-9.3.service
and /etc/systemd/system/postgresql-9.3.service
and reloaded the service.– lese
Oct 19 '15 at 18:52
Does echo
$PGDATA
still return empty line? mmmm how can it return the error "no such directory", it must be reading the value from somewhere else, we need to understand from where. It seems he say he has set the env variable in both files /usr/lib/systemd/system/postgresql-9.3.service
and /etc/systemd/system/postgresql-9.3.service
and reloaded the service.– lese
Oct 19 '15 at 18:52
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f236478%2fhow-to-update-postgres-conf-path-after-relocating-it-from-data-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
did you see this page (·:
– lese
Oct 15 '15 at 19:30