grails mongodb connection refused - mongodb

My grails app can connect to my local mongodb and works fine but when I deploy to cloud foundry, I get a connection refused error trying to connect to mongodb on cf.
I bound a mongodb service to my app, but it still can't connect?
barry-alexanders-MacBook-Pro:~ barryalexander$ vmc apps
+-------------+----+---------+-------------------------+-----------------+
| Application | # | Health | URLS | Services |
+-------------+----+---------+-------------------------+-----------------+
| RelCal | 1 | RUNNING | relcal.cloudfoundry.com | mongodb-a77900c |
| barry | 1 | STOPPED | barry.cloudfoundry.com | |
+-------------+----+---------+-------------------------+-----------------+
Here's the stack trace after hitting my app at http://relcal.cloudfoundry.com/release/calendar
Line | Method
->> 228 | _open in com.mongodb.DBPort
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 112 | go in ''
| 79 | call . . in ''
| 218 | call in com.mongodb.DBTCPConnector
| 305 | __find . in com.mongodb.DBApiLayer$MyCollection
| 369 | _check in com.mongodb.DBCursor
| 498 | _hasNext in ''
| 523 | hasNext in ''
| 40 | hasNext in com.google.code.morphia.query.MorphiaIterator
| 258 | asList in com.google.code.morphia.query.QueryImpl
| 20 | doCall . in com.gap.release.calendar.RelCalRestController$_closure1
^ 662 | run in java.lang.Thread
I'm missing something but don't know what.

At this time, when deploying grails/mongo apps to cloudfoundry, it's best to use the approach described at Cloud Foundry Services - Using MongoDB with Grails rather than using morphia.

Related

Issue in postgresql HA mode switching of Master node

I am new in postgresqlDB configuration. I am trying to configure postgresDB in HA mode with the help of pgpool and Elastic IP. Full setup is in AWS RHEL 8 servers.
pgpool version : 4.1.2
postgres version - 12
Below links I have followed during the configuration:
https://www.pgpool.net/docs/pgpool-II-4.1.2/en/html/example-cluster.html#EXAMPLE-CLUSTER-STRUCTURE
https://www.pgpool.net/docs/42/en/html/example-aws.html
https://www.enterprisedb.com/docs/pgpool/latest/03_configuring_connection_pooling/
Currently the postgres and pgpool services are up in all 3 component nodes. But if I am stopping master postgres service/server whole setup is going down and standby node is not taking the place of master. Please find the status of the pool nodes when master is down:
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | replication_state | replication_sync_state | last_status_change
---------+--------------+------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+---------------------
0 | server1 | 5432 | down | 0.333333 | standby | 0 | false | 0 | | | 2022-10-12 12:10:13
1 | server2 | 5432 | up | 0.333333 | standby | 0 | true | 0 | | | 2022-10-13 09:16:07
2 | server3 | 5432 | up | 0.333333 | standby | 0 | false | 0 | | | 2022-10-13 09:16:07
Any help would be appreciated. Thanks in advance.

CircleCI build fails when setting up add_ssh_keys config

We have a repository which now draws from a private repository for a particular component.
A BitBucket SSH key is required to get access to this.
It is a Flutter app and the private repo reference in pubspec.yaml looks like this:
our_private_api-repo:
git:
url: git#bitbucket.org:our_org/our-private-api-repo.git
ref: master
That all works just fine for local development.
Now I am trying to make the CircleCI deployment work.
I worked from these instructions, and these, successfully adding my "Additional SSH Key".
The problem has arisen with the step where I am supposed to add reference to the ssh key, as per the instructions:
- add_ssh_keys:
fingerprints:
- "SO:ME:FIN:G:ER:PR:IN:T"
I've got the correct fingerprint from the CircleCI backend, and I've put the lines in the correct place (just under the steps section for my job, but when I push this change, CircleCI now reports the following errors:
> # | | 3. [#/jobs/my-job/steps/3/fingerprints] no subschema matched out of the total 2 subschemas
> # | | | 1. [#/jobs/my-job/steps/3/fingerprints] expected type: Mapping, found: Sequence
> # | | | | SCHEMA:
> # | | | | type:
> # | | | | - object
> # | | | | - string
> # | | | | INPUT:
> # | | | | - 84:1a:fe:etc..(this is not it exactly)..:31:0f
> # | | | 2. [#/jobs/my-job/steps/3/fingerprints] expected type: String, found: Sequence
> # | | | | SCHEMA:
> # | | | | type:
> # | | | | - object
> # | | | | - string
> # | | | | INPUT:
> # | | | | - 84:1a:fe:etc..(this is not it exactly)..:31:0f
The error goes away if I remove the add_ssh_keys/fingerprints/fingerprint lines.
This was due to missing a tab in my config.yml file.
Changed:
- add_ssh_keys:
fingerprints:
- "84:1a:fe:SO:ME:FIN:G:ER:PR:IN:T"
To:
- add_ssh_keys:
fingerprints:
- "84:1a:fe:SO:ME:FIN:G:ER:PR:IN:T"

Unable to create new database

When I create a new mysql db, slashdb's test connection fails.
Here is how I log into mysql:
$ mysql -u 7stud -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.5.5-10.4.13-MariaDB Homebrew
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| chat |
| ectoing_repo |
| ejabberd |
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
+--------------------+
8 rows in set (0.00 sec)
mysql> use mydb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_mydb |
+----------------+
| cheetos |
| greetings |
| mody |
| people |
+----------------+
4 rows in set (0.00 sec)
mysql> select * from people;
+----+--------+------+
| id | name | info |
+----+--------+------+
| 1 | 7stud | abc |
| 2 | Beth | xxx |
| 3 | Diane | xyz |
| 4 | Kathy | xyz |
| 5 | Kathy | xyz |
| 6 | Dave | efg |
| 7 | Tom | zzz |
| 8 | David | abc |
| 9 | Eloise | abc |
| 10 | Jess | xyz |
| 11 | Jeffsy | 2.0 |
| 12 | XXX | xxx |
| 13 | XXX | xxx |
+----+--------+------+
13 rows in set (0.00 sec)
In the slashdb form for creating a new database, here is the info I entered:
Hostname: 127.0.0.1
Port: 80
Database Login: 7stud
Database Password: **
Database Name: mydb
Then I hit the "Test Connection" button, whereupon I get a spinning wheel, which disappears after a few minutes, but no "Connection Successful" message. What am I doing wrong?
Now, I'm using port 3306:
mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.00 sec)
but when slashdb tries to connect, I get the error:
Host localhost:3306 is not accessible
Your port is wrong in the database connection. You said that your MySQL is configured on port 3306, but you also posted your SlashDB config for database with port 80. Please change that to 3306.
Also, not sure how if you don't need to enable remote access to MySQL. Even if your SlashDB is running on the same machine as the MySQL database, it uses TCP/IP to connect.

Filter duplicate output over consecutive rolling period on Postgres

I have a simple table with daily regression test results and would like to get an output of tests that fail consecutively in the last 3 days.
The table looks something like this.
| ID | rule | status | environment | date | note |
------------------------------------------
| 1 | Test01 | pass | dev | 2018-05-23 |
| 2 | Test02 | pass | dev | 2018-05-23 |
| 3 | Test03 | pass | dev | 2018-05-23 |
| 4 | Test01 | pass | staging | 2018-05-23 |
| 5 | Test02 | pass | staging | 2018-05-23 |
| 6 | Test03 | pass | staging | 2018-05-23 |
| 7 | Test01 | pass | dev | 2018-05-24 |
| 8 | Test02 | fail | dev | 2018-05-24 | fail note
| 9 | Test03 | pass | dev | 2018-05-24 |
| 10 | Test01 | fail | dev | 2018-05-24 | fail note
| 11 | Test02 | fail | dev | 2018-05-24 | fail note
| 12 | Test03 | pass | dev | 2018-05-24 |
| 13 | Test01 | pass | dev | 2018-05-25 |
| 14 | Test02 | fail | dev | 2018-05-25 | fail note
| 15 | Test03 | fail | dev | 2018-05-25 | fail note
| 16 | Test01 | pass | dev | 2018-05-26 |
| 17 | Test02 | fail | dev | 2018-05-26 | fail note
| 18 | Test03 | pass | dev | 2018-05-26 |
So, assuming today is 2018-05-26 how do I output a result that shows the Test02 has been failing in the last 3 days or ID (rolling period) in Postgres?
The reason why I want it consecutive is because there may be tests that fail one day and pass the next and fail the next due to network issues so having consecutive requirement ensures elimination of that. Additionally there are also duplicate test runs during the same day (so Test01 can run multiple times during the same day potentially)
In respect to current date, you want to look through records that are dating maximum 2 days back from it and show only these rules for which you've found that a test has failed all the times it was done (for each environment separately):
select rule, environment
from t
where date > current_date - 3 -- for your sample data it's '2018-05-26'
group by rule, environment
having sum(case when status = 'fail' then 1 end) = count(*)
Output for your sample data and where date > '2018-05-26'::date - 3:
rule | environment
--------+-------------
Test02 | dev

Unable to start HandlerSocket with mariadb

For some reason, I cannot get HandlerSocket to start listening when I start mariadb (version
10.0.14). I am using Cent OS 6.5.
my.cnf has the following settings:
handlersocket_port = 9998
handlersocket_port_wr = 9999
handlersocket_address = 127.0.0.1
Calling "SHOW GLOBAL VARIABLES LIKE 'handlersocket%'" from the mariaDb prompt shows:
+-------------------------------+-----------+
| Variable_name | Value |
+-------------------------------+-----------+
| handlersocket_accept_balance | 0 |
| handlersocket_address | 127.0.0.1 |
| handlersocket_backlog | 32768 |
| handlersocket_epoll | 1 |
| handlersocket_plain_secret | |
| handlersocket_plain_secret_wr | |
| handlersocket_port | 9998 |
| handlersocket_port_wr | 9999 |
| handlersocket_rcvbuf | 0 |
| handlersocket_readsize | 0 |
| handlersocket_sndbuf | 0 |
| handlersocket_threads | 16 |
| handlersocket_threads_wr | 1 |
| handlersocket_timeout | 300 |
| handlersocket_verbose | 10 |
| handlersocket_wrlock_timeout | 12 |
+-------------------------------+-----------+
I can start mariadb successfully, but when I check to see which ports are actively listening,
neither 9998 nor 9999 show up. I've checked the mysqld.log file, but no errors seem to be occurring.
Answering my own question here -
SELINUX needed to be set to permissive mode to get HandlerSocket started.