Recently I had the problem of starting a postgresql service with custom PGDATA path. It tried to look in the default data directory (/var/lib/pgsql/9.3/data/) which was not initialized and therefore triggered these errors. It appears the problem is that the service starter on Centos 7 strips all the environment variables, including PGDATA.
Interesting thread on the issue
Is there a way to configure
service postgresql-9.3 start
to use custom environment variables? Are there configuration files for services where these variables have to be defined?
Thank you in advance!
Thanks for the above answer, we just ran into this change today. You can also keep the default settings and only override the PGDATA variable by putting the following in /etc/systemd/system/postgresql-9.3.service:
# Include the default config:
.include /lib/systemd/system/postgresql-9.3.service
[Service]
Environment=PGDATA=<your path here>/pgsql/9.3/data
This removes the need to reintegrate changes in /usr/lib/systemd/system/postgresql-9.3.service back to your local copy.
OK, I got a solution that worked for me.
nano /etc/systemd/system/postgresql-9.3.service
with the contents copied over from /usr/lib/systemd/system/postgresql-9.3.service and PGDATA variable changed. Then
systemctl daemon-reload
And then I started the service normally and it worked fine. The trick was making changes to this service configuration file.
Related
I had a working instance of CluedIn installed from the Home repo (https://github.com/CluedIn-io/Home).
For the last few days, I can't reach it. Say, my organization name is foobar: when I open http://foobar.127.0.0.1.xip.io:9080/ (which used to work just fine last week), my browser can't reach the page and shows DNS_PROBE_FINISHED_NXDOMAIN.
This issue happens when http://xip.io/ is down.
To solve the problem, please, use another wildcard DNS provider. For example, https://nip.io/.
There is only one change you need to do in the Home repo - in the .env file, change this line:
CLUEDIN_DOMAIN=127.0.0.1.xip.io
To this:
CLUEDIN_DOMAIN=127.0.0.1.nip.io
And then run ./cluedin.ps1 up.
Your site will be available at http://foobar.127.0.0.1.nip.io:9080/
Should you need to script this, you can run the following:
./cluedin.ps1 env -set CLUEDIN_DOMAIN=127.0.0.1.nip.io # sets for the default environment
or
./cluedin.ps1 env dev -set CLUEDIN_DOMAIN=127.0.0.1.nip.io # sets for a custom environment called dev
For the Helm chart you have to update the dns section ..
v3.2.2
global:
dns:
hostname: "127.0.0.1.nip.io"
.. or in older versions of the chart v3.2.1 and below ..
dns:
hostname: "127.0.0.1.nip.io"
Once deployed it should restart effected pods but the server, ui and gql deployments might need to be restarted to pick up new configmap values.
Hi I'm a student at Seneca in the OPS335 right now and I'm new here, so basically I setup a new DNS server on my Centos7 machine and got it working perfectly, all the zones in named.conf are setup right, all the records and files are in place, the ifcfg-ens33 and resolv.conf files are all set with the right 'IPs', 'DNS1' and 'namserver', 'search' parameters. The service is enabled to start at boot, but when i get to my terminal and try pinging google.ca or a host command it will not resolve until i manually restart the services even though they are active. Iptables are set to allow it in and out via its port (53). If anyone knows how to fix this please help me out, otherwise i had another idea with crontab.
Any help would be greatly appreciated.
So in order for me to make what i have work is to manually restart the iptables libvirtd and named services in that order, so i made a small script to do this and then tried adding it to crontab after testing it in terminal. I made it to restart the service at reboot and it works in the terminal, but when i try adding it to crontab with a new line at the end as :
#reboot /namedrestart2.bash
it does not work, named boots and is active and enabled, but it still will not resolve DNS queries.
I am not sure if i have the right PATH and SHELL set for crontab mine is :
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
SHELL=/bin/sh
MAILTO=root
The main result that i want is for named to boot properly so i dont have to go through this restart service hassle.
Again any help would be greatly appreciated.
i'm using licensed version of TYK Dashboard .So i need the change configuration of TYK Configs.
So at this link at the here https://tyk.io/docs/configure/dashboard-env-variables/ I've wanted to use environment variables at launch time of VM .
But these are not working on my machine (on-premis). I could not find the mistake in my approach .Please help .
My script is shown at below .
export TYK_DB_LICENSEKEY=$LICENSE_KEY
export TYK_DB_MONGOUSESSL=$MONGOUSESSL
sudo /opt/tyk-dashboard/install/setup.sh --listenport=3000 --redishost=$REDIS_HOST --redisport=6379 --tyk_api_hostname=$HOSTNAME --tyk_node_hostname=http://localhost --tyk_node_port=8080 --portal_root=/portal --domain="XXX.XXX.XXX.XXX"
At least I can handle the mongo url but LICENSE KEY parameter has no sign anywhere.
Please Help ME !
install/setup.sh simply sets up some sensible defaults inside your tyk_analytics.conf file.
You can either edit the /opt/tyk-dashboard/tyk_analytics.conf directly, and insert your license key in there. Then restart the dashboard service systemctl restart tyk-dashboard.
Alternatively, if you want to use environment variables, you need to set them globally on the machine, or in your tyk-dashboard systemd unit file.
edit /lib/systemd/system/tyk-dashboard.service
Add your environment variable inside the [Service] directive
Environment="TYK_DB_LICENSEKEY=FOOBARBAZ"
save & quit, then
systemctl daemon-reload
systemctl restart tyk-dashboard
More comprehensive answer here: https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service
There was not any cloud-config file in my coreOS, so I made one myself as below:
#cloud-config
hostname: coreos
ssh_authorized_keys:
-ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAgU0+1JMi9jzAiHSTu9GL4eNX0KzP5E5lN/0dczRcLF+uX4NSO9DCUUIlkGDml70aXrIHhawfR/TSz1YEkJeZDwWyRKgNeqTGXax1HncLF9kHaWxn7At34qmfWdu54zvtfhZVOV2FKWMC0A8hizkFY+LPV8rkM1Hjoik2f8FZ491ucy8Lygrtd0ZWDPBp/EyqG90JwHF6lEZanhq/2vVPTJdJtLelpdr0Ouvw132r3ex7tm76nj+T10DOsGntNfNr/VD8Z1UD2sRxG9JgWgVHVjYzfy5ISCQwvbYG6DZG+e33SxZb5Ch9B5h8vCaRgsA1DX1K+rdp5fxCF5h1VkxaMQ== rsa-key-20151214
But it did not work when I tried to log in with putty through ssh key, also got error when logged in
" server refused our key "
and
" Failed Units: 1
system-cloudinit#usr-share-oem-cloud\x2dconfig.yml.service "
Well I am confused about this cloud-config.
What should I do to make right one to work?
If anyone knows about coreOS, Please help me
The answer to your question depends on what type of CoreOS system you are running.
Also, from your question it isn't clear how you tried to set your system's cloud config.
If this is a bare metal install (you used the coreos-install tool to install to a physical system), you should have a cloud config file at /var/lib/coreos-install/user_data. user_data is your cloud config file here. It should have been created from the cloud-config.yml that was provided when running coreos-install.
For most of the other types of systems (CDROM/USB, PXE, vmWare, etc.) the cloud config file is usually part of the environment and read during every boot.
You can find the locations of the cloud config file for other CoreOS system types here.
If you didn't provide a cloud config during install, or in the environment you can use the following command to load a custom cloud config file:
sudo coreos-cloudinit --from-file=/home/core/cloud-config.yaml
of course you need to have command line access to do that. just in case you don't have console access yet, you can use the coreos.autologin Kernel parameter when you boot to skip login on the console.
You can validate your cloud-config at coreos.com/validate. I'm not sure that's what is failing here, but check it out if you keep running into issues.
Validater suggests this works? but maybe it's 3 parts?
#cloud-config
hostname: coreos
ssh_authorized_keys: ["-ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAgU0+1JMi9jzAiHSTu9GL4eNX0KzP5E5lN/0dczRcLF+uX4NSO9DCUUIlkGDml70aXrIHhawfR/TSz1YEkJeZDwWyRKgNeqTGXax1HncLF9kHaWxn7At34qmfWdu54zvtfhZVOV2FKWMC0A8hizkFY+LPV8rkM1Hjoik2f8FZ491ucy8Lygrtd0ZWDPBp/EyqG90JwHF6lEZanhq/2vVPTJdJtLelpdr0Ouvw132r3ex7tm76nj+T10DOsGntNfNr/VD8Z1UD2sRxG9JgWgVHVjYzfy5ISCQwvbYG6DZG+e33SxZb5Ch9B5h8vCaRgsA1DX1K+rdp5fxCF5h1VkxaMQ== rsa-key-20151214"]
I just installed the postgresql (as it says on postgresql), server is running like charm, no problem at all.
I just tried(want) to change the default port (5432) to (9898).
First I just tried to do it by postgresql.conf file under /var/lib/pgsql/data/postgresql.conf.
I just remove the comment for port related line, and change it as port=9898, but there is a comment saying overriding port here doesn't change anything for RHEL and deriven guys, it also says try to override the port config by service config file(cannot find it, where is it?).
I also change the postmaster.opts too (doesn't work the same).
Finally! how may I change the Postgresql 9.2.7 port number on CentOS 7?
Finally I found it, the service file is /lib/systemd/system/postgresql.service, I just change the following line.
Environment=PGPORT=9898
stop the service as
service postgresql stop
then reload the daemon services using this
systemctl daemon-reload
Finally start the postgresql using
service postgresql start
Now it's working like charm :D
Login to psql. Try
show config_file ;
That is the file you should change. Did you restart the server after changing the port?
You can also try the file under /etc/rc.d/init.d for PostgreSQL if it is running as a service.
From /lib/systemd/system/postgresql.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/postgresql.service",
# containing
# .include /lib/systemd/system/postgresql.service
# ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
# For example, if you want to change the server's port number to 5433,
# create a file named "/etc/systemd/system/postgresql.service" containing:
# .include /lib/systemd/system/postgresql.service
# [Service]
# Environment=PGPORT=5433
# This will override the setting appearing below.
I think it is better to follow the steps above.
I am using Amazon EC2 instance with Amazon Linux AMI release ( A kind of CentOS it seems). I needed to change PGPORT variable in /etc/init.d/postgresql file and restart the postgresql service using 'service postgresql restart'. And it works!!
PGPORT=some_new_port # /etc/init.d/postgresql