How to change server port number of AgensGraph? - agens-graph

AgensGraph can not startup.
When AgensGraph installed multiple instance on same server, Some AgensGraph can't startup.
$ ag_ctl start
ag_ctl: another server might be running; trying to start server anyway
server starting
Is there config parameter about it?

There is configuration parameter of port number on "postgresql.conf" file.
See the directory "$AGDATA", you can found "postgresql.conf" file.
$ grep ^#port $AGDATA/postgresql.conf
#port = 5432 # (change requires restart)
$ vi $AGDATA/postgresql.conf
<<< FIX Port Number >>>
$ grep ^port $AGDATA/postgresql.conf
port = 9999 # (change requires restart)
After fix port number, Restart your AgensGraph.
$ ag_ctl restart
waiting for server to shut down..... done
server stopped
waiting for server to start.... done
server started
After restart, you can access to AgensGraph on new port number.
$ agens -p 9999
agens (AgensGraph 2.1.0, based on PostgreSQL 10.4)
Type "help" for help.
agens=#

Related

SQL Server 2017 on Linux/Kubernetes -- Set up TLS Security

Trying to configure TLS on my MSSQL connections following this article: https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-encrypted-connections?view=sql-server-2017
The server-side configuration seems pretty straight-forward with minor differences in the container environment (e.g. systemctl doesn't exist so I kill/respawn pod):
systemctl stop mssql-server
cat /var/opt/mssql/mssql.conf
/opt/mssql/bin/mssql-conf set network.tlscert /var/opt/mssql/ssl/mssql.pem
/opt/mssql/bin/mssql-conf set network.tlskey /var/opt/mssql/ssl/mssqlprivkey.key
/opt/mssql/bin/mssql-conf set network.tlsprotocols 1.2
/opt/mssql/bin/mssql-conf set network.forceencryption 0
systemctl start mssql-server
So I took my PFX from my Windows CA and extracted the key and the client cert to key and pem files, added them to the location for persistent storage (/var/opt), ran the commands (seen above) and sql came back up.
I installed mssql-tools on a different machine and configured it in the trust-anchors to trust my CA.
However, when trying to test the connection (sqlcmd -N -S tcp:1.1.1.1,1433 -U user -P password), I get the error: SSL Provider: [error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed:subject name does not match host name]
When I change the connection string to the DNS name, it works (sqlcmd -N -S tcp:mssql.mydomain.com,1433 -U user -P password) -- even though the IP address is listed as a subject alternative name on the cert.
Why are secure connections not working using the IP? What am I missing?
Different TLS client tools differently handle IP Address Subject Alternative Name type. Most Microsoft tools ignore iPAddress name type completely and require IP addresses to be listed as dNSName name type. Try to add IP Address to SAN extension as dNSName name type, it should work.

can not connect a DB instance Running the PostgreSQL Database Engine to pgadmin4

I want to configure Postgres with pgadmin on centos7. but unable to create a server on pgadmin.
I edited file /var/lib/pgsql/data/pg_hba.conf as this :
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
and edited file /var/lib/pgsql/data/postgresql.conf as this :
listen_addresses = '*'
port = 5432
the I restarted PostgreSQL with this command: sudo systemctl restart postgresql
and here is my configuration in pgadmin4:
but after I click on the save button nothing happens
so my question is how to configure Postgres with pgadmin on centos7, and what I've done wrong in this process?

How to connect sql server using docker on mac?

I am trying to connect to sql server using docker. I have successfully enabled the container using this command
sudo docker run -d --name aakash -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Maximus6hero#" -p 1434:1434 microsoft/mssql-server-linux
docker ps
3e41723b93d5 microsoft/mssql-server-linux "/opt/mssql/bin/sqls…" About an hour ago Up About an hour 1433/tcp, 0.0.0.0:1434->1434/tcp aakash
It shows that my container is running.
But when i try to connect using db visualizer it throws an error.
The TCP/IP connection to the host localhost, port 1434 has failed. Error: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2000 or later.". ClientConnectionId:6a802ae0-7203-411d-a599-4c1de997d843.
I also have windows pc with me, and i can connect easily using sql server management studio. Even i can connect others pc using that windows pc. But when i try to connect my mac to windows pc using its ip it also gives the same error.
I have enabled tcp/ip connection on windows using sql server configuration manager. But there is no such thing on mac.
You might be getting this error on your MAC because when you run the docker in the background, it uses only 2GB of memory by default which is insufficient to run the SQL server as it needs minimum of 3.25 GB and ideally, we should point it to 4GB of memory. Update the preferences section with above details on your docker. Save and restart the docker and you may check the below steps to see if that might help you for your MAC. I did this using Azure Data Studio and Docker.
Once you have Saved and restart the docker with 4GB of Memory Allocation for docker to run, all you'd need to do is pull the docker image of the sql server and download it. this can be done by below commands on your terminal . FYI, I am using bash commands below:
Command 1:
sudo docker pull mcr.microsoft.com/mssql/server:2017-latest
This will pull the latest vesion docker image and download. Once done, you need to set your SQL authentication on the server for your database. Follow below commands:
Command 2:
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<SetYourPasswordHere>' \
-p 1433:1433 --name sql1 \
-d mcr.microsoft.com/mssql/server:2017-latest
This sets your password and uses the port 1433 for SQL server (which is the default port). To confirm if the image has been created and the SQL server is running on docker, execute the below command to check log(s).
Command 3:
docker ps
To check all instances in your history of dockers( i.e. if you already had dockers installed before you are attempting this SQL connection/execution), run the below command and it will give you all the logs of all instances you have created
Command 4:
docker ps -a
or
docker ps -all
Once, you have completed above steps and see that the docker has created SQL instance, you need to go to Azure Data Studio and set the below credentials to access the server that you just created above using Docker.
Server: localhost
Authentication Type: SQL Authentication
Username: sa
Password: <Check Command 2 to see what you entered in the password where it says SetYourPasswordHere>
Hope this helps in your tryst with running SQL server on your MAC. All the Best!

Trouble connecting to SQL Server with sqlcmd from inside Docker

Working with debian linux inside a docker contaier. I have sqlcmd working properly and the neseccary drivers are installed and locatable. I know the server exists:
root#0feafecac36f:/home/shiny# nmap -p 31010 -sT xxx.xxx.xxx.xxx
Starting Nmap 7.60 ( https://nmap.org ) at 2018-01-25 20:46 UTC
Nmap scan report for nile-h.tmthk.org (xxx.xxx.xxx.xxx)
Host is up (0.019s latency).
PORT STATE SERVICE
31010/tcp filtered unknown
Nmap done: 1 IP address (1 host up) scanned in 0.59 seconds
But, for the life of me, I cannot figure out how to connect using sqlcmd, and I am not sure what tricks I have at my disposal to help. This command results in an error:
sqlcmd -S nile-h.tmthk.org,31010 -U "*********" -P "********"
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not
accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
I have confirmed that the user name and password are correct. So, what could be going on here? Any ideas? I've tried many iterations of the sqlcmd to try to get it right but so far nothing is working.
EDIT: Telnet
root#0feafecac36f:/home/shiny# telnet xxx.xxx.xxx.xxx 31010
Trying xxx.xxx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused
EDIT: tcptraceroute
root#0feafecac36f:/home/shiny# tcptraceroute xxx.xxx.xxx.xxx 31010
Selected device eth0, address 172.17.0.2, port 33859 for outgoing packets
Tracing the path to xxx.xxx.xxx.xxx on TCP port 31010, 30 hops max
1 172.17.0.1 0.241 ms 0.179 ms 0.156 ms
2 nile-h.tmthk.org (xxx.xxx.xxx.xxx) [closed] 1012.571 ms 1003.511 ms 1003.485 ms
EDIT: ip route get
root#0feafecac36f:/home/shiny# ip route get xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx via 172.17.0.1 dev eth0 src 172.17.0.2
cache
EDIT: Dockerfile
FROM r-base:3.4.0
RUN apt-get update && apt-get install -y \
apt-utils \
curl \
libcurl4-openssl-dev \
libssl-dev \
r-cran-rjava \
gnupg2 \
r-cran-rodbc \
unixodbc \
unixodbc-dev \
apt-transport-https \
debconf-utils \
gcc \
libct4 \
libsybdb5 \
tdsodbc \
sqsh \
mlocate \
sudo \
gfortran
ENV PATH="/opt/mssql-tools/bin:${PATH}"
RUN useradd -u 5555 -m -d /home/shiny -c "shiny user" shiny
ADD . /home/shiny/
RUN chown -R shiny:shiny /home/shiny
RUN chmod 755 /home/shiny/install_sql.sh
WORKDIR /home/shiny
RUN Rscript installRpackages.R
RUN chmod 755 /home/shiny/install_sql.sh && /home/shiny/install_sql.sh
RUN R -e "install.packages('devtools')"
RUN R -e "devtools::install_github('rstudio/DT')"
RUN R -e "devtools::install_github('timelyportfolio/parcoords')"
RUN R -e "devtools::install_github('ropensci/plotly') ; library(plotly)"
RUN R -e "devtools::install_github('rstudio/crosstalk',force=TRUE) ; library(crosstalk)"
RUN R -e "install.packages(c('plotly'), dependencies = TRUE, repos='https://cran.rstudio.com/')"
RUN wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb"
RUN sudo apt install ./libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb
USER shiny
EXPOSE 7777
CMD Rscript start.R
And finally, the install_sql.sh called by the Dockerfile:
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
apt-get update
ACCEPT_EULA=Y apt-get install msodbcsql
# optional: for bcp and sqlcmd
ACCEPT_EULA=Y apt-get install mssql-tools
# optional: for unixODBC development headers
apt-get install unixodbc-dev
Judging by the nmap output you have shared I believe this to be a firewall issue or the server SQL Server itself blocks access. According to man nmap:
The state is either open, filtered, closed, or unfiltered [... ] Filtered. means that a firewall, filter, or other network obstacle is blocking the port so that Nmap cannot tell whether it is open or closed.
Reading the sqlcmd output (A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible) also points in this direction according to this Microsoft post which also offers some possible solutions.
IF the SQL Server is managed by yourself, you may check its logs to see why it refuses your connection and also add a firewall rule to allow access from your container. IF that's not the case, you may need to talk with the admin of that server and ask him to add your IP in the firewall list/accepted connections list in the server's configuration file.
If firewall is not your issue, please try applying the below settings to your SQL Server and re-test the connection.
Set "Listen to All" to No in the SQL Server Configuration Manager >
SQL Server Network Configuration > Protocols for [instance name]. And
under IP Address change 127.0.0.1 to the [ip] used to connect. Don't
forget to restart the SQL Server!
Other tip: check your firewall (or temporaly disable it for testing).
Also allow remote connections in SQL Server properties > Connections.
See above posts.
Life safer was this command: nc -zv <ip> 1433
It should say Connection to 1433 port [tcp/ms-sql-s] succeeded!
The original source is here.
Reading from your question, I'm assuming you want to connect to your local SQL Server from inside Docker.
SQL Server can be connected to over TCP/IP:
Open SQL Server Configuration Manager and make sure TCP/IP is enabled;
Make sure SQL Server is listening on all IP addresses.

pgpool can't create database

I have started the pgpool using the command
sudo pgpool -n &
it started giving the following message on the terminal:
2012-05-04 10:54:29 LOG: pid 4109: pgpool-II successfully started. version 2.3.2.1 (tomiteboshi)
But when I try to run the following command:
createdb -p 9999 bench_replication
I get the following error message:
createdb: could not connect to database postgres: could not connect to server: No such file or directory.
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.9999"?
When I change the port from 9999 to 5432, a database bench_replication is created on the local node only, not on slave nodes. But, tutorial say to mention port 9999 in this command in order to create database bench_replication on all slave nodes through pgpool.
To confirm whether pgpool is really running or not, I stop the pgpool using command
2012-05-04 10:58:50 LOG: pid 4109: received smart shutdown request
stop request sent to pgpool. waiting for termination...done.
[1]+ Done sudo -A pgpool -n
which confirms the pgpool was actually running. What am I doing wrong? I have changed all my pgpool configuration file as mentioned in the standard tutorials on net.
Try this command :
createdb -p 9999 -h 127.0.0.1 bench_replication
By default PostgreSQL try to use the socket.
Late response but useful for future generations:
When you run
createdb -p 9999 bench_replication
under root, this generates the following error in log:
no pg_hba.conf entry for host "12.34.56.78", user "root", database
"postgres", SSL off
This means you should explicit mention username just like this:
createdb -U postgres -p 9999 bench_replication
Then you will get another error:
no pg_hba.conf entry for host "12.34.56.78", user "postgres", database
"postgres", SSL off
So you were blocked by second node on HBA level.
In this case either you should allow on second node access from first (in pg_hba.conf):
host all postgres 12.34.56.77 trust
or you should set password:
createdb -U postgres -p 9999 bench_replication -W SoMeP4Ssw0rD
If this is not clear enough - just check for your logs.

Resources