Create an Equinox instance of Karaf - configuration

I am running Karaf 3.0.1 with Equinox core. Now I want to create a new instance which also runs Equinox core. I have tried:
instance:create test
The created instance runs Felix core so I tried to update its configuration ${karaf.home}/instances/test/etc/config.properties. After adjusting, whenever I tried to connect to this instance, I received:
karaf#root: instance:connect test
Connecting to host localhost on port 8105
Error executing command: Failed to get the session
What wrong did I do? and Is there another way to create a Equinox core instance?

Use instance:clone rather than instance:create
Make sure you start the instance after you've created / cloned it
before trying to connect.
i.e.
karaf#root()> bundle:list -t 0 | grep '^ 0'
0 | Active | 0 | 3.8.2.v20130124-134944 | OSGi System Bundle
karaf#root()> instance:clone root test
karaf#root()> instance:list
SSH Port | RMI Registry | RMI Server | State | PID | Name
-------------------------------------------------------------
8101 | 1099 | 44444 | Started | 29306 | root
8101 | 1099 | 44444 | Stopped | 0 | test
karaf#root()> instance:ssh-port-change test 8102
karaf#root()> instance:rmi-server-port-change test 44445
karaf#root()> instance:rmi-registry-port-change test 1100
karaf#root()> instance:list
SSH Port | RMI Registry | RMI Server | State | PID | Name
-------------------------------------------------------------
8101 | 1099 | 44444 | Started | 29306 | root
8102 | 1100 | 44445 | Stopped | 0 | test
karaf#root()> instance:start test
karaf#root()> instance:connect test
Connecting to host localhost on port 8102
Connecting to unknown server. Automatically adding to known hosts.
Storing the server key in known_hosts.
Password: *****
Connected
__ __ ____
/ //_/____ __________ _/ __/
/ ,< / __ `/ ___/ __ `/ /_
/ /| |/ /_/ / / / /_/ / __/
/_/ |_|\__,_/_/ \__,_/_/
Apache Karaf (3.0.2)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit 'system:shutdown' to shutdown Karaf.
Hit '<ctrl-d>' or type 'logout' to disconnect shell from current session.
karaf#test()> bundle:list -t 0 | grep '^ 0'
0 | Active | 0 | 3.8.2.v20130124-134944 | OSGi System Bundle
karaf#test()>

Related

Mysql Unable to connect to the database

We have problem to run php script via crontab. There are around 70 lines that run scripts installed in different virtual servers. When few lines are executed everything is working but when we have more some of them are not executed.
First we thought that this is crontab issue, but then we figure out that we are getting error from the script 'Error msg: Unable to connect to the database'. Just to let you now this script allow applications, that we have installed on our VPS to execut of the system's scheduled sending script (so you we can schedule our emails to be sent at a later date) on our server.
By getting this error we know that problem exist in the mysql engine. We are not mysql experts so maybe someone knows what to do with this. Here are few outputs from our mysql.
Uptime: 80832 Threads: 60 Questions: 4116373
Slow queries: 2067 Opens: 69721 Flush tables: 2
Open tables: 400 Queries per second avg: 50.925
and
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| Aborted_connects | 64 |
| Connections | 671995 |
| Max_used_connections | 215 |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_finished_connects | 0 |
| Threads_connected | 60 |
+--------------------------+--------+
Do you see something suspicious here? Connections are opened only on localhost. In /etc/my.cnf there is a setup
bind-address = 127.0.0.1

postfix not substituting %s

Postfix 3.1.4 on Debian Stretch appears to be failing to substitute the address it's attempting to resolve with mysql_table.
I have /etc/postfix/sasl/smtpd.conf configured (below), but it never authenticates. When I check the MySQL log table, I see:
| 2017-08-28 23:19:54 | postfix[postfix] # localhost [127.0.0.1] | 834 | 0 | Query | START TRANSACTION |
| 2017-08-28 23:19:54 | postfix[postfix] # localhost [127.0.0.1] | 834 | 0 | Query | SELECT password FROM mailbox WHERE username = '%s' |
| 2017-08-28 23:19:54 | postfix[postfix] # localhost [127.0.0.1] | 834 | 0 | Query | SELECT password FROM mailbox WHERE username = '%s' |
| 2017-08-28 23:19:54 | postfix[postfix] # localhost [127.0.0.1] | 834 | 0 | Query | COMMIT
When %s is a postfix template, not a MySQL / MariaDB one. It should be filling in the email address, or the user here, but it appears to just be copying this from the configs verbatim.
Here is the content of /etc/postfix/sasl/smtpd.conf:
autheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: sql
sql_hostnames: 127.0.0.1
sql_user: [redacted]
sql_passwd: [redacted]
sql_database: [redacted]
sql_select: SELECT password FROM mailbox WHERE username = '%s'
log_level:10
Seems this works: select password from users where email = '%u#%r', but %s does not.

mysql - show processlist

When I run the command show processlist; I get details of the connections made to the server. Here are the connection details of my MySQL server,
mysql> show processlist;
+------+-----------------+----------------------+-------------+---------+----------+------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+-----------------+----------------------+-------------+---------+----------+------------------------+------------------+
| 1 | event_scheduler | localhost | NULL | Daemon | 13200075 | Waiting on empty queue | NULL |
| 4212 | root | localhost | NULL | Query | 0 | init | show processlist |
| 4214 | root | xxx.xx.xxx.xxx:50197 | testmysqldb | Sleep | 1 | | NULL |
| 4215 | root | xxx.xx.xxx.xxx:50198 | testmysqldb | Sleep | 3 | | NULL |
+------+-----------------+----------------------+-------------+---------+----------+------------------------+------------------+
What does the "number" after the term hostname and a colon (:) mean? It generally appears when a remote connection is made, on Linux and appears even for local connection on Windows.
Thanks in Advance!!
It's the client's port number used for the connection.
"xxx.xx.xxx.xxx:50197" means that there's an open connection from IP address "xxx.xx.xxx.xxx" and port 50197, towards your MySQL server (probably on port 3306.)
This is the client's TCP Port.
You connect to the server for example on default port 3306 but the client uses a different port on its side of the connection. This port is listed there.
It's client port number i.e. a connection gets open between two processes (on the same host or physically apart) using sockets - Socket is host_ip:port_num
So when we connect to a mysql (on same machine - localhost or remote server) a connection is opened i.e.
client_ip:xxxxx --> mysql_ip:3306 (3306 is default for Mysql, can use other port as well)
Example:
xxx.xx.xxx.xxx:50197
We send query and receive response from the mysql (mysql_ip:3306) at client_ip:50197

Sequel Pro or other Non-Socket connections refused in MySql 5.6.26

Ok, I have looked at about 15 answers to this question on here, and none of them work.
I am on a Mac, running OSX 10.10, MySql 5.6.26
Whenever I try to connect with Sequel Pro I get the following:
Unable to connect to host 127.0.0.1 because access was denied.
My users are in my MySql dump, with grant on all of them to .
+----------------------+----------+
| Host | User |
+----------------------+----------+
| % | macfelon |
| 127.0.0.1 | macfelon |
| 127.0.0.1 | root |
| ::1 | root |
| localhost | |
| localhost | macfelon |
| localhost | root |
| robert-macbook.local | |
| robert-macbook.local | root |
+----------------------+----------+
My port is open at 3306. It connects with the Socket option, but not on Standard.
Nothing I can find seems to resolve this for me.
Are you absolutely certain it's actually listening on port 3306? There's an answer here: https://dba.stackexchange.com/questions/108522/mac-os-x-10-10-mysql-5-6-26-accessible-from-cli-but-not-port-3306 where others are reporting that the configuration in my.cnf is being ignored, and for some reason MySQL 5.6.26 configures /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist to use port 3307 by default. Modifying that .plist to port 3306 solved this issue for me.

apache/mysql generate too many request on amazon centos

My issue is, my website open too many connections in mysql server this is hanged my website and also generate many requests on apache. i have installed the apache module mod-evasive and mod-security i have also empty the iptables rules basically i am using amazon ec2 so it gives security ip i have blocked all outbound and inbound i have opened only 443,80 and ssh 22 port only but still when i take netstat it shows
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
4 --0.0.0.0
4 ---119.159.195.199
25 ---54.69.254.252
374 ---
on above my question is why my server 374 apache connection on ::1:80 how can block this or reduce this
mysql connection stat are
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Connections | 5208 |
| Threads_cached | 0 |
| Threads_connected | 54 |
| Threads_created | 5207 |
| Threads_running | 54 |
+-------------------+-------+
5 rows in set (0.00 sec)
my second question is why my sql connections is increasing.
Please any one help me i will really appreciated.