newrelic mysql java plugin connection issue - java

Needed Some help, I installed the newrelic mysql plugin, and created a user from script but when I start the agent using java -jar newrelic_mysql_plugin-1.2.0.jar it gives me
com.newrelic.metrics.publish.binding.Context | SEVERE | Unable to
obtain a new database connection: jdbc:mysql://localhost:3306/
root/PASSWORD_FILTERED, check your MySQL configuration settings.
Access denied for user 'root'#'127.0.0.1' (using password: YES)
I tried to use it using root credentials for mysql but same error. i can connect from localhost shell using root credentials. and my mysql.instance.json is:
[ { "name" : "MyApp", "host" : "localhost:3306", "metrics" :
"status,newrelic", "user" : "root", "passwd" : "mypassword" }, ]
Reference for Plugin: http://newrelic.com/plugins/new-relic-inc/52

found the issue, the default script didn't create the user#'127.0.0.1' just created user#localhost. i created it manually and now its working like charm. just posting the issue hope it will help others.
You can see if user is created or not using
SELECT User FROM mysql.user;
Or to Create a User with limited rights in mysql shell just use.
CREATE USER newrelic#localhost IDENTIFIED BY 'yourpass';
GRANT PROCESS,REPLICATION CLIENT ON . TO newrelic#localhost;
CREATE USER newrelic#127.0.0.1 IDENTIFIED BY 'yourpass';
GRANT PROCESS,REPLICATION CLIENT ON . TO newrelic#127.0.0.1;
and Define your password in Clean test in mysql json.

Related

Cannot connect to local DynamoDB

I cannot connect to DynamoDB that is running local using cli.
aws dynamodb list-tables --endpoint-url http://localhost:8000
Could not connect to the endpoint URL: "http://localhost:8000/"
This doesn't work either:
aws dynamodb list-tables --region local
Could not connect to the endpoint URL: "http://localhost:8000/"
I tried using a different port and that didn't help. I disabled all proxies too.
I am able to connect to DynamoDB using an application like this so I know it's not a dynamodb issue:
aws dynamodb list-tables --endpoint-url http://dynamodb.us-west-2.amazonaws.com --region us-west-2
{
"TableNames": [
"Music"
]
}
😭😭😭
When you run
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
command from your terminal make sure output will be like below and no service will be running on port 8000:
Initializing DynamoDB Local with the following configuration:
Port: 8000
InMemory: false
DbPath: null
SharedDb: true
shouldDelayTransientStatuses: false
CorsParams: *
It means, this service running successfully on port 8000.
DynamoDB requires any/fake credentials to work.
AWS Access Key ID: "fakeMyKeyId"
AWS Secret Access Key: "fakeSecretAccessKey"
then try below command to list tables.
aws dynamodb list-tables --endpoint-url http://localhost:8000
The error in your logs is the key here Caused by: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64 in java.library.path: [.]
This means that the specific dependency cannot be located.
The link that Saranjeet provided has a few solutions. I prefer this solution for testing:
First, you need to download the zip file from offcial website. Unzip the file, copy all the *.dll, *.dylib, *.so to a folder under your project root. Say, src/test/resources/libs.
Then, add the code
System.setProperty("sqlite4java.library.path", "src/test/resources/libs/");
before you initialize a local instance of AmazonDynamoDB.

MySql error "Cannot create PoolableConnectionFactory (Could not create connection to database server.)" while connecting with azkaban?

I am trying to connect Azkaban ( A job scheduler for hadoop) with my local mysql. The configiration file of azkaban looks like:
database.type=mysql
mysql.port=3306
mysql.host=localhost
mysql.database=azkaban
#Changed by Prakhar for azkaban , Azkaban
mysql.user=root
mysql.password= [ Password of mysql ]
My MySql has a database named "azkaban" and i am able to login mysql using command:
./mysql -u root -p
Also mysql is working on port 3306, which i have verified.
Still i am unable to connect to mysql. The logs of azkaban looks like this:
2020/04/11 22:38:05.584 +0530 ERROR [MySQLDataSource] [Azkaban] Failed to find write-enabled DB connection. Wait 15 seconds and retry. No.Attempt = 1
java.sql.SQLException: Cannot create PoolableConnectionFactory (Could not create connection to database server.)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
at azkaban.db.MySQLDataSource.getConnection(MySQLDataSource.java:76)
at org.apache.commons.dbutils.AbstractQueryRunner.prepareConnection(AbstractQueryRunner.java:175)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:286)
at azkaban.db.DatabaseOperator.query(DatabaseOperator.java:68)
at azkaban.executor.ExecutorDao.fetchActiveExecutors(ExecutorDao.java:53)
at azkaban.executor.JdbcExecutorLoader.fetchActiveExecutors(JdbcExecutorLoader.java:266)
at azkaban.executor.ExecutorManager.setupExecutors(ExecutorManager.java:223)
at azkaban.executor.ExecutorManager.<init>(ExecutorManager.java:131)
at azkaban.executor.ExecutorManager$$FastClassByGuice$$e1c1dfed.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
at
Few pointers that might help you to resolve the issue.
Please check the version of MySQL installed vs the MySQL client mentioned in the Gradle file used to build Azkaban
Preferably use MySQL 5.x version
Make sure to install the compatible client version
Also, create the Mysql tables in the database before starting the web executor

how to run docker Image assuming an IAM role on local machine?

I am working with docker
I am provided a docker image which compiles and runs fine
the application uses Amazon client to interact services like S3 , SNS , SQS .
the moment the application tries to load the client it fails with error
Caused by: com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider#17bf085: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper#24117d53: Unable to load credentials from service endpoint
I have tested on cli that application local IAM configuration is correct
get caller identity on console
aws sts get-caller-identity
output
{
"Account": "xxxxxxxxxxxx",
"UserId": "XXXXXXXXXXXXXXXXXXXXX:xxxxxxxx-session-1562266255",
"Arn": "arn:aws:sts::342484191705:assumed-role/abc-abc-abc-abc/xxxxxxxx-session-1562266255"
}
so the IAM role is assumed correctly on local machine ,
running unit test and integration test on local machine also assume the IAM role perfectly .
I am running the docker image by command
docker run -it --rm -e "JPDA_ADDRESS=*:8000" -e "JPDA_TRANSPORT=dt_socket" -p 5033:8000 -p 6060:6033 --memory 1300M --log-driver json-file --log-opt "max-size=1g" docker-image-arn dev
the image runs but fails all operation where it has to assume IAM role and interact with AWS services .
what is missing ?
how to make application within the container use the IAM role ?

Unable to connect mongodb with remote public IP server

I am facing a problem connecting to mongodb from my machine to public IP server on which mongodb installed as a windows service with --auth
When I removed authentication as below command, I am able to access the database collection
mongod --install --noauth --dbpath "c:\mongodb\data" --logpath
"c:\mongodb\logs\log.txt" --bind_ip "0.0.0.0"
And when I use the --auth in place of --noauth, I am getting the following error:
errmsg : "auth failed" code :18 login failed
And I am giving correct login details to connect to the mongodb.
What is causing this and how can I fix it?
What command are you using to connect to your database?
If you use mongo like mongo -u login -p password -h xxx.yyy.zzz.aaa try to add --authenticationDatabase admin.

h2 cluster with file based database

I have set up an h2 cluster but cannot connect via the console or using a datasource all I get is this:
IO Exception: "java.io.IOException: The filename, directory name, or volume label syntax is incorrect"; "E:/baseDirDefinedInServerConnection/myDB,localhost:1112/myDB" [90031-176] 90031/90031 (Help)
I have configured 2 servers thus:
java -cp h2-1.3.167.jar org.h2.tools.Server -tcp -tcpPort 1111 -tcpAllowOthers -baseDir E:\myBaseDir
at tcp://myIp:1111 (others can connect)
java -cp h2-1.3.167.jar org.h2.tools.Server -tcp -tcpPort 1112 -tcpAllowOthers -baseDir E:\myBaseDir\server
at tcp://myIp:1112 (others can connect)
So you see I have one database in a directory (this has been created) and another database in another directory. Both are up and running.
I have run the cluster tool thus:
java -cp h2-1.3.167.jar org.h2.tools.CreateCluster -urlSource jdbc:h2:tcp://localhost:1111/myDB -urlTarget jdbc:h2
:tcp://localhost:1112/myDB -user username -password pass -serverList localhost:1111,localhost:1112
And it all looks good. If I try to connect thorugh the console without the cluster list I get this message, which proves we are in clustered mode, which is good:
Clustering error - database currently runs in cluster mode, server list: 'localhost:1111,localhost:1112'" [
I have checked the permissions on the directories and all has read/write access.
Yes this is a windows machine.
Using H2 version:
Bundle-Vendor: H2 Group
Bundle-Version: 1.3.167
Any ideas what I might have done wrong?
Thanks for reading.
Guess you already found out that one should connect like this
jdbc:h2:tcp://localhost:1111,localhost:1112/myDB

Categories