Openshift and Splunk HEC integration for logging - openshift

I am able to set up Splunk in OpenShift and install splunk-connect using helm. I did create indexes and enable HEC (HTTP Event Collector) and created a HEC token. Splunk HEC values.yaml is completed with appropriate values. All pods are up and running but i am seeing no OpenShift logs in Splunk. Error I am seeing
use_rest_client_ssl true
1282
cluster_name openshiftlab
1283
interval 15s
1284
</source> is not used.
1285
2022-08-19 13:22:22 +0000 [info]: #0 starting fluentd worker pid=186 ppid=1 worker=0
1286
2022-08-19 13:22:22 +0000 [error]: #0 unexpected error error_class=RestClient::SSLCertificateNotVerified error="SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)"
1287
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:776:in `rescue in transmit'
1288
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:651:in `transmit'
1289
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:163:in `execute'
1290
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `execute'
1291
2022-08-19 13:22:22 +0000 [error]: #0 /opt/app-root/src/gem/fluent-plugin-kubernetes-metrics-1.2.0/lib/fluent/plugin/in_kubernetes_metrics.rb:695:in `is_stats_endpoint_available?'
1292
2022-08-19 13:22:22 +0000 [error]: #0 /opt/app-root/src/gem/fluent-plugin-kubernetes-metrics-1.2.0/lib/fluent/plugin/in_kubernetes_metrics.rb:95:in `start'
1293
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:203:in `block in start'
1294
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:192:in `block (2 levels) in lifecycle'
1295
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:191:in `each'
1296
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:191:in `block in lifecycle'
1297
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:178:in `each'
1298
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:178:in `lifecycle'
1299
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/root_agent.rb:202:in `start'
1300
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/engine.rb:248:in `start'
1301
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/engine.rb:147:in `run'
1302
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/supervisor.rb:760:in `block in run_worker'
1303
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/supervisor.rb:1036:in `main_process'
1304
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/supervisor.rb:751:in `run_worker'
1305
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/lib/fluent/command/fluentd.rb:386:in `<top (required)>'
1306
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/bin/fluentd:15:in `require'
1307
2022-08-19 13:22:22 +0000 [error]: #0 /usr/share/gems/gems/fluentd-1.15.1/bin/fluentd:15:in `<top (required)>'
1308
2022-08-19 13:22:22 +0000 [error]: #0 /usr/bin/fluentd:23:in `load'
1309
2022-08-19 13:22:22 +0000 [error]: #0 /usr/bin/fluentd:23:in `<main>'
1310
2022-08-19 13:22:22 +0000 [error]: #0 unexpected error error_class=RestClient::SSLCertificateNotVerified error="SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)"

Did you try setting insecureSSL: true in the values.yaml file and then redeploying?

Related

Ubuntu 17.10 - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I've seen similar questions being asked on stack overflow but none of them seem to solve my issue properly. I have recently upgraded my system from Ubuntu 16.04 to Ubuntu 17.10 . Since then, I've been experiencing a problem with mysql where I'm not able to start it up properly and it shows the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
I've searched for many solutions online and as a last effort also tried uninstalling and reinstalling but the problem resurfaces after a few days or few attempts. Upon running "service mysql start", it shows:
Job for mysql.service failed because the control process exited with
error code.
See "systemctl status mysql.service" and "journalctl -xe" for
details.
Upon running the suggested commands it shows the following logs:
systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor
preset: enabled)
Active: activating (start-post) (Result: exit-code) since Thu 2018-
02-22 09:06:31 IST; 4s ago
Process: 8936 ExecStart=/usr/sbin/mysqld (code=exited,
status=1/FAILURE)
Process: 8930 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
(code=exited, status=0/SUCCESS)
Main PID: 8936 (code=exited, status=1/FAILURE); Control PID: 8937
(mysql-systemd-s)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/mysql.service
└─control
├─8937 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─8948 sleep 1
Feb 22 09:06:31 vamshi-Lenovo-G50-70 systemd[1]: Starting MySQL
Community Server...
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:31.948822Z 0 [Warning] Changed limits: max_open_files: 1024
(requested 5000)
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:31.948879Z 0 [Warning] Changed limits: table_open_cache: 431
(requested 2000)
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:32.126417Z 0 [Warning] TIMESTAMP with implicit DEFAULT value
is deprecated. Please use --explicit_def
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:32.128149Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.21-
0ubuntu0.17.10.1) starting as process 8936 ...
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:32.130652Z 0 [ERROR] Could not open file
'/var/log/mysql/error.log' for error logging: No such file o
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:32.130675Z 0 [ERROR] Aborting
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:32.130694Z 0 [Note] Binlog end
Feb 22 09:06:32 vamshi-Lenovo-G50-70 mysqld[8936]: 2018-02-
22T03:36:32.130750Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
Feb 22 09:06:32 vamshi-Lenovo-G50-70 systemd[1]: mysql.service: Main
process exited, code=exited, status=1/FAILURE
journalctl -xe
Feb 22 09:11:21 vamshi-Lenovo-G50-70 gnome-shell[2902]:
[AppIndicatorSupport-WARN] Attempting to re-register
:1.69/org/ayatana/NotificationItem/multiload; resetting inst
Feb 22 09:11:21 vamshi-Lenovo-G50-70 gnome-shell[2902]:
[AppIndicatorSupport-WARN] Item
:1.69/org/ayatana/NotificationItem/multiload is already registered
ESCOD
Every time this happens, I uninstall mysql and reinstall(server not client), and then it works alright for the first few attempts, then it goes back to same situation. Thanks in advance!
ls -al
total 32824
drwxrwxr-x 8 root syslog 4096 Feb 22 08:44 .
drwxr-xr-x 14 root root 4096 Feb 16 2017 ..
-rw-r--r-- 1 root root 1527 Feb 17 08:58 alternatives.log
-rw-r----- 1 root adm 0 Feb 22 08:44 apport.log
-rw-r----- 1 root adm 486 Feb 21 07:29 apport.log.1
-rw-r----- 1 root adm 455 Feb 20 20:54 apport.log.2.gz
-rw-r----- 1 root adm 514 Feb 19 21:42 apport.log.3.gz
-rw-r----- 1 root adm 758 Feb 19 18:15 apport.log.4.gz
-rw-r----- 1 root adm 459 Feb 17 23:07 apport.log.5.gz
-rw-r----- 1 root adm 1389 Feb 16 00:33 apport.log.6.gz
-rw-r----- 1 root adm 275 Feb 14 20:16 apport.log.7.gz
drwxr-xr-x 2 root root 4096 Feb 17 08:55 apt
-rw-r----- 1 syslog adm 86558 Feb 22 09:17 auth.log
-rw-r----- 1 syslog adm 97522 Feb 18 18:02 auth.log.1
-rw------- 1 root utmp 0 Feb 14 20:17 btmp
drwxr-x--- 2 root lp 4096 Feb 22 08:44 cups
drwxr-xr-x 2 root root 4096 Feb 5 14:51 dist-upgrade
-rw-r--r-- 1 root root 30036 Feb 17 08:58 dpkg.log
drwx--x--x 2 root gdm 4096 Feb 14 20:18 gdm3
-rw-r--r-- 1 root root 2136 Feb 22 08:39 gpu-manager.log
-rw-r----- 1 syslog adm 3745433 Feb 22 09:28 kern.log
-rw-r----- 1 syslog adm 2302923 Feb 18 18:07 kern.log.1
-rw-rw-r-- 1 root utmp 0 Feb 14 20:17 lastlog
-rw-r----- 1 syslog adm 657 Feb 22 08:40 mail.log
-rw-r----- 1 syslog adm 1971 Feb 18 15:31 mail.log.1
-rw-r----- 1 syslog adm 3706136 Feb 22 09:28 syslog
-rw-r----- 1 syslog adm 18760212 Feb 22 08:44 syslog.1
-rw-r----- 1 syslog adm 989385 Feb 21 07:07 syslog.2.gz
-rw-r----- 1 syslog adm 587416 Feb 20 09:09 syslog.3.gz
-rw-r----- 1 syslog adm 593456 Feb 19 18:21 syslog.4.gz
-rw-r----- 1 syslog adm 672682 Feb 18 18:07 syslog.5.gz
-rw-r----- 1 syslog adm 166575 Feb 17 09:09 syslog.6.gz
-rw-r----- 1 syslog adm 891827 Feb 16 00:44 syslog.7.gz
-rw-r----- 1 syslog adm 572158 Feb 22 09:28 ufw.log
-rw-r----- 1 syslog adm 234885 Feb 18 18:06 ufw.log.1
drwxr-xr-x 2 root root 4096 Feb 15 22:00 unattended-upgrades
drwxr-xr-x 2 root root 4096 Feb 22 08:40 vmware
-rw-rw-r-- 1 root utmp 20736 Feb 22 08:41 wtmp
Create folder /var/log/mysql and make sure mysqld can write to it.

Issues using DateTime function with Julia

When I read a csv file in my Jupyter notebook I got the following output
54×9 Array{Any,2}:
"\"25 Nov 2015\"" 28637 11314 3804 2536 10675 4808 14122 3955
"\"18 Nov 2015\"" 28634 11314 3804 2536 10672 4808 14122 3955
"\"11 Nov 2015\"" 28635 11314 3805 2536 10672 4808 14122 3955
"\"4 Nov 2015\"" 28607 11314 3810 2536 10672 4808 14089 3955
"\"25 Oct 2015\"" 28539 11298 3806 2535 10672 4808 14061 3955
⋮ ⋮
"\"12 May 2014\"" 260 182 248 171 12 11 "" ""
"\"1 May 2014\"" 239 160 226 149 13 11 "" ""
"\"14 Apr 2014\"" 176 110 168 108 8 2 "" ""
"\"31 Mar 2014\"" 130 82 122 80 8 2 "" ""
"\"22 Mar 2014\"" 49 29 49 29 "" "" "" ""
I want to change the first column content into a day-month-year format in order to calculate the years passed since first observation (which in this case is my last row).
I tried converting the column using string, then using a for loop (Suppose the name of my file is "ebola"
dias = string.(ebola[:,1])
for i = 1:length(dias)
dias[i] = DateTime(dias[i], "d-m-y")
end
After that, I got this error message
ArgumentError: Unable to parse date time. Expected directive DatePart(d) at char 1
I suppose this error arises because the string has a non-conventional format to manipulate it, with four "" symbols and some backslashes:
"\"25 Nov 2015\""
I must add that when i type, for example:
length("\"22 Mar 2014\"")
result is 13 when you can count 17 characters so clearly backslashes are making some "noise".
What can I don to convert the string in a proper format in order to perform the tasks I want to do?
Any help will be much appreciated.
The reason is that "\"22 Mar 2014\"" is a string containing " characters inside. You can check it by printing it:
julia> s = "\"22 Mar 2014\""
"\"22 Mar 2014\""
julia> print(s)
"22 Mar 2014"
In order to parse the date use a proper format string, e.g.:
julia> Date(s,"\"d u y\"")
2014-03-22
Here is how you can perform the conversion from your array:
julia> x = ["\"25 Nov 2015\"" 28637 11314 3804 2536 10675 4808 14122 3955
"\"18 Nov 2015\"" 28634 11314 3804 2536 10672 4808 14122 3955
"\"11 Nov 2015\"" 28635 11314 3805 2536 10672 4808 14122 3955
"\"4 Nov 2015\"" 28607 11314 3810 2536 10672 4808 14089 3955
"\"25 Oct 2015\"" 28539 11298 3806 2535 10672 4808 14061 3955]
5×9 Array{Any,2}:
"\"25 Nov 2015\"" 28637 11314 3804 2536 10675 4808 14122 3955
"\"18 Nov 2015\"" 28634 11314 3804 2536 10672 4808 14122 3955
"\"11 Nov 2015\"" 28635 11314 3805 2536 10672 4808 14122 3955
"\"4 Nov 2015\"" 28607 11314 3810 2536 10672 4808 14089 3955
"\"25 Oct 2015\"" 28539 11298 3806 2535 10672 4808 14061 3955
julia> Date.(x[:,1], "\"d u y\"")
5-element Array{Date,1}:
2015-11-25
2015-11-18
2015-11-11
2015-11-04
2015-10-25

Rails 3.2.13 app fails after shared host Mysql update

I have two Rails 3.2.13 apps on Justhost server.
Recently they updated Mysql to Mysql2, after that I got errors:
Ruby (Rack) application could not be started
And specific:
Error message:
(Mysql2::Error)
My setup:
bundle show mysql turns : /home3/ecotec11/rails_apps/ecotechno/vendor/bundle/ruby/1.9.3/gems/mysql2-0.3.16
In database.yml
production:
adapter: mysql2
encoding: utf8
reconnect: true
database: database_name
pool: 5
username: username
password: password
# socket: /tmp/mysql.sock
Gemfile:
gem 'mysql2'
Bassicaly when I contacted support they said they can't help me.
Full backtrace of error :
0 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/mysql2-0.3.16/lib/mysql2/client.rb 24 in `initialize_ext'
1 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/mysql2-0.3.16/lib/mysql2/client.rb 24 in `initialize'
2 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/mysql2_adapter.rb 16 in `new'
3 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/mysql2_adapter.rb 16 in `mysql2_connection'
4 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 315 in `new_connection'
5 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 325 in `checkout_new_connection'
6 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 247 in `block (2 levels) in checkout'
7 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 242 in `loop'
8 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 242 in `block in checkout'
9 /usr/lib64/ruby/1.9.3/monitor.rb 211 in `mon_synchronize'
10 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 239 in `checkout'
11 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 102 in `block in connection'
12 /usr/lib64/ruby/1.9.3/monitor.rb 211 in `mon_synchronize'
13 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 101 in `connection'
14 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb 410 in `retrieve_connection'
15 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb 171 in `retrieve_connection'
16 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb 145 in `connection'
17 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/model_schema.rb 310 in `clear_cache!'
18 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activerecord-3.2.16/lib/active_record/railtie.rb 103 in `block (2 levels) in '
19 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.16/lib/active_support/callbacks.rb 418 in `_run__4470304995410275411__prepare__777669663684257344__callbacks'
20 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.16/lib/active_support/callbacks.rb 405 in `__run_callback'
21 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.16/lib/active_support/callbacks.rb 385 in `_run_prepare_callbacks'
22 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.16/lib/active_support/callbacks.rb 81 in `run_callbacks'
23 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb 74 in `prepare!'
24 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb 48 in `prepare!'
25 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/application/finisher.rb 47 in `block in '
26 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/initializable.rb 30 in `instance_exec'
27 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/initializable.rb 30 in `run'
28 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/initializable.rb 55 in `block in run_initializers'
29 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/initializable.rb 54 in `each'
30 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/initializable.rb 54 in `run_initializers'
31 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/application.rb 136 in `initialize!'
32 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/railties-3.2.16/lib/rails/railtie/configurable.rb 30 in `method_missing'
33 /home3/ecotec11/rails_apps/technorent/config/environment.rb 10 in `'
34 config.ru 3 in `require'
35 config.ru 3 in `block in
'
36 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/rack-1.4.5/lib/rack/builder.rb 51 in `instance_eval'
37 /home3/ecotec11/rails_apps/technorent/vendor/bundle/ruby/1.9.3/gems/rack-1.4.5/lib/rack/builder.rb 51 in `initialize'
38 config.ru 1 in `new'
39 config.ru 1 in `
'
40 /etc/httpd/modules/passenger/lib/phusion_passenger/rack/application_spawner.rb 225 in `eval'
41 /etc/httpd/modules/passenger/lib/phusion_passenger/rack/application_spawner.rb 225 in `load_rack_app'
42 /etc/httpd/modules/passenger/lib/phusion_passenger/rack/application_spawner.rb 157 in `block in initialize_server'
43 /etc/httpd/modules/passenger/lib/phusion_passenger/utils.rb 563 in `report_app_init_status'
44 /etc/httpd/modules/passenger/lib/phusion_passenger/rack/application_spawner.rb 154 in `initialize_server'
45 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
46 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server.rb 180 in `start'
47 /etc/httpd/modules/passenger/lib/phusion_passenger/rack/application_spawner.rb 129 in `start'
48 /etc/httpd/modules/passenger/lib/phusion_passenger/spawn_manager.rb 253 in `block (2 levels) in spawn_rack_application'
49 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add'
50 /etc/httpd/modules/passenger/lib/phusion_passenger/spawn_manager.rb 246 in `block in spawn_rack_application'
51 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server_collection.rb 82 in `block in synchronize'
52 prelude> 10:in `synchronize'
53 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize'
54 /etc/httpd/modules/passenger/lib/phusion_passenger/spawn_manager.rb 244 in `spawn_rack_application'
55 /etc/httpd/modules/passenger/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application'
56 /etc/httpd/modules/passenger/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
57 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'
58 /etc/httpd/modules/passenger/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'
59 /etc/httpd/modules/passenger/helper-scripts/passenger-spawn-server 99 in `
In application logs :
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Connecting to database specified by database.yml
I checked databases are present. Users with passwords are valid.
I tested if console works. Yes it works.
rails console production
I was able to create new record and also update existing one!
This makes me think what is wrong then ? If just for webservice database is not working ?
So from where this problem comes ?
Any tip would be great.
thanks
I solved this easily by reverting to mysql, and adding the port number 3306 to my database.yml
*for the record my app is on shared hosting on Bluehost.
previous database.yml:
development:
adapter: mysql2
database: my_db
encoding: utf8
username: my_username
password: my_password
host: localhost
reconnect: true
current database.yml:
development:
adapter: mysql
database: my_db
encoding: utf8
username: my_username
password: my_password
host: 127.0.0.1
reconnect: true
socket: mysql
port: 3306

MySQL crashes because out of memory

On my website VPS the MySQL goes down quite often, once a day lately.
I've looked in my syslog and seems like it is an Out Of Memory error.
Is my MySQL not configured the right way or is does my VPS not have enough memory for what I'm running on it?
Here are free and top:
$ free -m
total used free shared buffers cached
Mem: 512 360 151 0 0 42
-/+ buffers/cache: 317 194
Swap: 0 0 0
top - 14:17:47 up 15 days, 9:41, 2 users, load average: 0.13, 0.30, 0.42
Tasks: 58 total, 1 running, 57 sleeping, 0 stopped, 0 zombie
Cpu(s): 19.7%us, 2.7%sy, 0.0%ni, 77.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 524508k total, 415200k used, 109308k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 72404k cached
In my.cnf:
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
I'm using
mysql Ver 14.14 Distrib 5.1.66, for debian-linux-gnu (x86_64) using readline 6.1
on
Debian GNU/Linux 6.0.7 (squeeze)
Here is the block from my syslog:
Jun 23 21:19:01 vps528 kernel: [1182395.730776] mysqld invoked oom-killer: gfp_mask=0x1201d2, order=0, oomkilladj=0
Jun 23 21:19:01 vps528 kernel: [1182395.730789] Pid: 13220, comm: mysqld Not tainted 2.6.24-19-xen #1
Jun 23 21:19:01 vps528 kernel: [1182395.730791]
Jun 23 21:19:01 vps528 kernel: [1182395.730792] Call Trace:
Jun 23 21:19:01 vps528 kernel: [1182395.730802] [<ffffffff80275e26>] oom_kill_process+0xf6/0x110
Jun 23 21:19:01 vps528 kernel: [1182395.730806] [<ffffffff802762ae>] out_of_memory+0x19e/0x1e0
Jun 23 21:19:01 vps528 kernel: [1182395.730810] [<ffffffff80278bd9>] __alloc_pages+0x389/0x3c0
Jun 23 21:19:01 vps528 kernel: [1182395.730815] [<ffffffff8027af54>] __do_page_cache_readahead+0x104/0x260
Jun 23 21:19:01 vps528 kernel: [1182395.730818] [<ffffffff8027520e>] filemap_fault+0x2de/0x3e0
Jun 23 21:19:01 vps528 kernel: [1182395.730822] [<ffffffff80281f3a>] __do_fault+0x6a/0x5d0
Jun 23 21:19:01 vps528 kernel: [1182395.730824] [<ffffffff80287551>] handle_mm_fault+0x1d1/0xd60
Jun 23 21:19:01 vps528 kernel: [1182395.730829] [<ffffffff80229f63>] set_next_entity+0x23/0x50
Jun 23 21:19:01 vps528 kernel: [1182395.730835] [<ffffffff80473553>] do_page_fault+0x1f3/0x11e0
Jun 23 21:19:01 vps528 kernel: [1182395.730840] [<ffffffff8046f7e9>] thread_return+0x3a/0x481
Jun 23 21:19:01 vps528 kernel: [1182395.730845] [<ffffffff80471bf7>] error_exit+0x0/0x79
Jun 23 21:19:01 vps528 kernel: [1182395.730848]
Jun 23 21:19:01 vps528 kernel: [1182395.730850] Mem-info:
Jun 23 21:19:01 vps528 kernel: [1182395.730851] DMA per-cpu:
Jun 23 21:19:01 vps528 kernel: [1182395.730853] CPU 0: Hot: hi: 0, btch: 1 usd: 0 Cold: hi: 0, btch: 1 usd: 0
Jun 23 21:19:01 vps528 kernel: [1182395.730855] DMA32 per-cpu:
Jun 23 21:19:01 vps528 kernel: [1182395.730857] CPU 0: Hot: hi: 186, btch: 31 usd: 172 Cold: hi: 62, btch: 15 usd: 14
Jun 23 21:19:01 vps528 kernel: [1182395.730861] Active:94084 inactive:618 dirty:0 writeback:0 unstable:0
Jun 23 21:19:01 vps528 kernel: [1182395.730861] free:4898 slab:3594 mapped:0 pagetables:3925 bounce:0
Jun 23 21:19:01 vps528 kernel: [1182395.730866] DMA free:11540kB min:28kB low:32kB high:40kB active:0kB inactive:0kB present:16160kB pages_scanned:0 all_unreclaimable? yes
Jun 23 21:19:01 vps528 kernel: [1182395.730869] lowmem_reserve[]: 0 4024 4024 4024
Jun 23 21:19:01 vps528 kernel: [1182395.730875] DMA32 free:8052kB min:8100kB low:10124kB high:12148kB active:376336kB inactive:2472kB present:4120800kB pages_scanned:767723 all_unreclaimable? yes
Jun 23 21:19:01 vps528 kernel: [1182395.730878] lowmem_reserve[]: 0 0 0 0
Jun 23 21:19:01 vps528 kernel: [1182395.730881] DMA: 3*4kB 3*8kB 3*16kB 4*32kB 3*64kB 1*128kB 1*256kB 1*512kB 2*1024kB 0*2048kB 2*4096kB = 11540kB
Jun 23 21:19:01 vps528 kernel: [1182395.730900] DMA32: 62*4kB 4*8kB 3*16kB 4*32kB 2*64kB 0*128kB 1*256kB 0*512kB 1*1024kB 1*2048kB 1*4096kB = 8008kB
Jun 23 21:19:01 vps528 kernel: [1182395.730908] Swap cache: add 0, delete 0, find 0/0, race 0+0
Jun 23 21:19:01 vps528 kernel: [1182395.730910] Free swap = 0kB
Jun 23 21:19:01 vps528 kernel: [1182395.730911] Total swap = 0kB
Jun 23 21:19:01 vps528 kernel: [1182395.730912] Free swap: 0kB
Jun 23 21:19:01 vps528 kernel: [1182395.740886] 1048576 pages of RAM
Jun 23 21:19:01 vps528 kernel: [1182395.740893] 21255 reserved pages
Jun 23 21:19:01 vps528 kernel: [1182395.740894] 39897 pages shared
Jun 23 21:19:01 vps528 kernel: [1182395.740895] 0 pages swap cached
Jun 23 21:19:01 vps528 kernel: [1182395.740898] Out of memory: kill process 25246 (apache2) score 73450 or a child
Jun 23 21:19:01 vps528 kernel: [1182395.740913] Killed process 25246 (apache2)
Looks like the VPS I am running doesn't have enough RAM for the amount of website and databases I am running on it. I'll be upgrading my VPS to one with 1GB of memory.

Unable to start Mongrel (or Passenger) on Debian due to mysql2 or mysql gems

I originally posted this at Super User, but now think it should be here instead...
I'm trying to port my RoR webapp over to a DreamHost VPS. I've upgraded the VPS --> Ruby 1.9.2 from 1.8.7 and am using Rails 3.0.1 and the mysql2 (0.2.6) gem. I'm getting the following error when trying to start mongrel:
/usr/bin/ruby1.8: symbol lookup error: /home/USERNAME/.gems/gems/mysql2-0.2.6/lib/mysql2/mysql2.so: undefined symbol: rb_intern2
...so I tried using the mysql (2.8.1) gem instead and get the following error:
wrong argument type Mysql (expected Struct) (TypeError)
0 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb 600 in real_connect'
1 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb 600 inconnect'
2 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb 164 in initialize'
3 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb 36 innew'
4 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/mysql_adapter.rb 36 in mysql_connection'
5 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 230 insend'
6 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 230 in new_connection'
7 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 238 incheckout_new_connection'
8 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 194 in checkout'
9 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 190 inloop'
10 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 190 in checkout'
11 /usr/lib/ruby/1.8/monitor.rb 242 insynchronize'
12 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 189 in checkout'
13 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 96 inconnection'
14 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb 318 in retrieve_connection'
15 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb 97 inretrieve_connection'
16 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb 89 in connection'
17 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/associations.rb 1804 increate_has_and_belongs_to_many_reflection'
18 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/associations.rb 1411 in has_and_belongs_to_many'
19 /home/USERNAME/.gems/gems/activerecord-3.0.1/lib/active_record/autosave_association.rb 137 inhas_and_belongs_to_many'
20 /home/USERNAME/portfoliofinearts.ca/farr/app/models/project.rb 3
21 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 239 in require'
22 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 239 inrequire'
23 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 227 in load_dependency'
24 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 239 inrequire'
25 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 346 in require_or_load'
26 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 300 independ_on'
27 /home/USERNAME/.gems/gems/activesupport-3.0.1/lib/active_support/dependencies.rb 216 in require_dependency'
28 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/engine.rb 138 ineager_load!'
29 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/engine.rb 137 in each'
30 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/engine.rb 137 ineager_load!'
31 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/engine.rb 135 in each'
32 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/engine.rb 135 ineager_load!'
33 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/application.rb 108 in eager_load!'
34 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/application/finisher.rb 41
35 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/initializable.rb 25 ininstance_exec'
36 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/initializable.rb 25 in run'
37 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/initializable.rb 50 inrun_initializers'
38 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/initializable.rb 49 in each'
39 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/initializable.rb 49 inrun_initializers'
40 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/application.rb 134 in initialize!'
41 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/application.rb 77 insend'
42 /home/USERNAME/.gems/gems/railties-3.0.1/lib/rails/application.rb 77 in method_missing'
43 /home/USERNAME/mydomain.com/test_app/config/environment.rb 10
44 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 ingem_original_require'
45 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in require'
46 config.ru 3
47 /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb 46 ininstance_eval'
48 /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb 46 in initialize'
49 config.ru 1 innew'
50 config.ru 1
I'd prefer to use mysql2, so that's the preferred solution I'm looking for, but I will certainly appreciate input on either problem.
I'm not encountering any problems such as this in my development environment (which is windows)
You'd mentioned that you're running Ruby 1.9.2 but your error dump looks like it's running Ruby 1.8 I'm not sure that this would cause the problem or not but it seems like a potential issue.
I'd uninstall ruby1.8 and see if it fixes anything.
sudo apt-get remove ruby1.8