Need help to change postgresql port on CentOS 7 - linux

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

Related

Thingsboard container doesn't update on config change

I am trying to update database config (parameters such as certain ports, db address etc.). Unfortunately only some ports change according to logs.
I am using following dockerfile
FROM thingsboard/tb-cassandra #repo link https://github.com/thingsboard/thingsboard/tree/master/msa/tb
RUN sed -i "s/:5683/:12090/g" /usr/share/thingsboard/conf/thingsboard.yml #this one works
RUN sed -i "s/localhost:5432/postgres:5432/g" /usr/share/thingsboard/conf/thingsboard.yml #this one doesnt update anything
What can cause such a behavior? Is there a way to deploy the solution

TYK Dashboard and Gateway Environment Variables Usage

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

Setting up SonarQube on AWS using EC2

Trying to setup SonarQube on EC2 using what should be basic install settings.
List item
Setup a standard EC2 AWS LINUX Ami attached to M4 large
SSH into EC2 instance
Install JAVA
Set to use JAVA8
wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.4.zip
unzip into the /etc dir
run sudo ./sonar.sh start
Instance starts
But when I try to go to the app it never comes up when I try either the IPv4 Public IP 187.187.87.87:9000 (ex not real IP) or try ec2-134-73-134-114.compute-1.amazonaws.com:9000 (not real IP either just for example)
Perhaps it is my ignorance or me not configuring something correctly as it pertains to the initial EC2 setup.
If anyone has any ideas, please let me know.
Issue was that SonarQube default port is 9000. and by default this port is not open in the security group if you dont apply the default security group in which all the ports are open(which is Not recommended).
As suggested in comment #Issac, opened the 9000 port to allow incoming request to SonarQube, in AWS security group setting of instance. Which solved the issue.
need to have an db and give permissions to the db insonar.properties file in sonar nd need to open firewalls

Centos 7 environment variables for Postgres service

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.

How to change the host name of the ubuntu server running oracle xe

I have a oracle 11g XE instance running under ubuntu server. I tried changing the hostname of the server by modifying the host name in /etc/hostname, /etc/hosts, tnsnames.ora and listener.ora but the oracle-xe instance fails to start after reboot. Any idea which configuration I am missing?
Sometimes Oracle starts with only certain services / functionalities not working properly... If that's the case and your Oracle instance partially failed to start you can get some more information about running listeners by invoking the lsnrctl command line utility and then using the status command.
You can also look for clues in the Oracle log files under <oracle-install>/app/oracle/diag/tnslsnr/<hostname>/listener/alert/log.xml - you should definitely have one for your old hostname and you might have another one created for your new hostname as well.
I had this and solved it just rename your listner.ora and restart, it will change the setting for the new host name
see my explanation Here

Resources