I'm trying to write a monitoring plugin for Artifactory using MySQL. The idea is that the plugin will collect some data using the Artifactory public API and some command line utilities, then write that data to a MySQL database to be analysed later. The problem is that the plugin can't find the jdbc driver. I placed the driver JAR in <artifactory-home>/etc/plugins/lib and I'm registering it like so:
def sql = Sql.newInstance('jdbc:mysql://localhost:3306/artifactoryTest', <user>, <pass>, 'com.mysql.jdbc.Driver')
This results in a ClassNotFoundException on com.mysql.jdbc.Driver. It seems the class loader used by Artifactory can't find the JAR.
Is there a way to make this work or am I barking up the wrong tree? I'm aware there may be some database technologies that would be better suited for this purpose but many seem like overkill for such a basic use case and I'd like to keep it as simple as possible.
Turns out this is indeed possible. Artifactory can be configured to use a number of different databases, including MySQL, so I figured there must be a way to use the same driver that Artifactory uses and indeed there is.
In the documentation for setting up Artifactory with MySQL it says:
Download the MySQL JDBC driver (available from the MySQL website)
and copy the mysql-connector-java-.jar file into the server's
shared lib directory. For example $TOMCAT_HOME/lib when installed as
a service or $ARTIFACTORY_HOME/tomcat/lib in the standalone version.
Simply dropping the JDBC driver JAR in the shared lib directory makes it available for use within plugins. I imagine this approach would work for any other JARs too.
Related
I am trying to install Ejabberd with mysql and followed this blog.
https://www.ejabberd.im/Using%20ejabberd%20with%20MySQL%20native%20driver
but I can't find any bean files for MySQL
https://www.ejabberd.im/doc/display/CONTRIBS/Yxa
mysql.beam
mysql_auth.beam
mysql_conn.beam
mysql_recv.beam
I have configured all the other things other than copying bean files.
The documentation you are referring to is obsolete. Use of MySQL with ejabberd is now fully integrated / packaged. If you build from source, you need to pass the proper --enable-mysql option. If using binary installer or packages from ProcessOne, the MySQL driver is already included.
What you need is to load schema into your database and configure "odbc" to use your MySQL database.
With a Cloudera install of HBase, I saw three places have config information :
/etc/hbase/conf/hbase-site.xml,
/usr/lib/hbase/conf/hbase-site.xml,
and /var/run/cloudera-scm-agent/process/*-hbase-MASTER
Which one exactly is in effect? Or maybe all of them do?
In all cases of hbase the /etc/hbase/conf/hbase-site.xml file is always read. The /usr/lib/hbase/conf/hbase-site.xml is a symlink to /etc/hbase/conf/hbase-site.xml so it is the same file.
Lastly, anything in /var/run/ is a runtime variable and in your case it is the Cloudera Manager Agent. The Manager Agents are responsible for the management console and logging amongst other tasks.
I hope that helps,
Pat
The config file used is /usr/lib/hbase/conf/hbase-site.xml.
Other files aren't symbolic links.
Since the same configuration information needs to be used for other processes like HMaster,RegionServer, /usr/lib/hbase/conf/hbase-site.xml file is synced at different locations while initializing/preprocessing of these daemons. Hence it is advised to make any configuration changes in /usr/lib/hbase/conf/hbase-site.xml file only.
Also you need to make the same changes to these file on all nodes in your cluster and restart the HBase daemons.
I hope these answer your question.
Per my search and learning, HBase actually has two types of hbase-site.xml files, one for HMaster/RegionServer, and the other for client.
In Cloudera's distribution, the hbase-site.xml file in folder /var/run/cloudera-scm-agent/process/*-hbase-MASTER is the config used by the running HMaster process. Similar is for RegionServer.
Yet the site.xml file under /usr/lib/hbase/conf/ and /etc/hbase/conf/, symlinked from one to the other (according to #apesa), is for client usage. If one starts HBase shell on an HMaster host or a RegionServer host, this client config file will be used so the shell application knows how to connect to the ZooKeeper quorum to obtain the running HBase service. If one wants to use the HBase service from a client host, then he needs to copy this client xml file to the client host.
For regular Apache installation of HBase, as was indicated in Sachin's answer, the same hbase-site.xml is used for both purposes, though the HMaster, the RegionServer, and the client processes will use only the options needed and ignore the rest.
From experimenting with the hbase binary version 1.2.0-cdh5.16.1, it appears to use the Java classpath to find the hbase-site.xml file to use, whether running as a server or a client shell. There is a configuration parameter (--config) you can pass to hbase to control the config directory used, which by default is ./conf (run hbase to view the documented help on this).
This observation is supported by other answers on this topic (e.g. Question 14327367).
Therefore, to answer your specific question, to determine which config file is used on your machine, run hbase classpath and find which of the 3 directories appears first in the classpath.
I would like to extract and load data from mysql DB to another mysql DB without shutting down mysql in the process.
Tried to use the open source Talend community edition.
Used mysql input component, filled connection details which were tested to work.
Component could not connect to mysql and got the error:
Exception in component tMysqlOutput_1
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
though I added to eclipse project the jar: mysql-connector-java-5.0.8.jar
The mysql components in talend should absolutely work out of the box without the need to load any additional drivers. I'd say reinstall talend because something else is wrong.
To manually load your mysql connector, you can use the tLibraryLoad component.
Choose the jar file from the dropdown in the "Basic Settings". It should be there if it's been included in the project.
You can also pick a lib path in the component's advanced settings and add the import line below that.
Again, you certainly shouldn't need to do this for the mysql component. Talend comes with the drivers to connect to all databases that have components.
In fact I've copied those drivers to other programs that didn't come with them.
Good luck!
Is a portable version of MySQL for Linux available?
You don't need to "install" mysql. Its binaries will run from any directory (given appropriate search paths etc), and its configuration can be specified entirely on the command-line, if necessary, bypassing the likes of /etc/my.cnf, or by specifying an alternative config file with arbitrary path.
Some engines can work with a readonly data directory (MyISAM, Archive), others may require a read/write data directory (Innodb) but that could be a temporary area or ramdisc.
There's nothing "un-portable" about MySQL.
To have a Portable Version of MySQL in linux, you can compile it to a Generic location
./configure --prefix=/myworkspace/installs/mysql --exec-prefix=/myworkspace/installs/mysql
Then usual
make
make install
this will install mysql on /myworkspace/installs/mysql. Then you can zip the whole mysql folder and can take it anywhere except you can run it from the same directory structure you have installed. Compiling mysql requires some dependencies, check it out here http://dev.mysql.com/doc/refman/5.6/en/source-installation.html .
If you install these dependencies also in /myworkspace/installs/mysqldepends/ , then your mysql is totally portable.
MySQL Embedded Server is available for purchase.
I advice you to use SQLite
I am using Eclipse EE IDE and I am using the MySql Connector/J driver. How do I set up a properties file with all the information(DB URL, DBusername,etc) Also I see that you need a DBname and DBurl for the properties file, How do I determine/create this name for the database. I have already looked at the mysql website for this and am still having trouble, if somebody could pleasee help me I would appreciate it.
Solution: I was able to get it working through the plugin available with Eclipse, but I soon realized this limited me with the use of my Tomcat server, so I re organized my directories and set up Tomcat to use with my Eclipse and also be available to other resources.
Eclipse doesn't use a database for anything, so even if you would create a properties file, it would ignore it.
If you're using the DB plugin, then you can use the UI to create a connection for the database. The wizard will ask for all the informations and save them somewhere (probably not as a property file).
If you need the database in your own project, then you must define the format of the property file yourself, read it at startup, and use the information to create a datasource.
You should use phpMyAdmin, or MySQL GUI tools for MySQL setup and management