Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECONNREFUSED/ENOENT after deploy #63

Open
HamburgerJungeJr opened this issue Mar 9, 2016 · 9 comments
Open

ECONNREFUSED/ENOENT after deploy #63

HamburgerJungeJr opened this issue Mar 9, 2016 · 9 comments

Comments

@HamburgerJungeJr
Copy link

Hi,

i try to connect to a mysql database on an ubuntu server.
I've deployed my application with meteor-up. The application is running but i cannot conenct to my mysql database.

If I use host/port I got the Error

{ [Error: connect ECONNREFUSED]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  fatal: true }
Exception from sub termineDetail id nSMvTBC3ihCw6jk2h Error: Cannot enqueue Query after fatal error.
    at Object.Future.wait (/bundle/bundle/programs/server/node_modules/fibers/future.js:398:15)
    at LiveMysqlSelect.LiveMysql.LiveMysqlSelect._publishCursor (packages/numtel_mysql/packages/numtel_mysql.js:55:1)
    at [object Object]._.extend._publishHandlerResult (livedata_server.js:1065:13)
    at [object Object]._.extend._runHandler (livedata_server.js:1038:10)
    at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
    at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
    at livedata_server.js:548:43
    - - - - -
    at Protocol._validateEnqueue (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql/lib/protocol/Protocol.js:194:16)
    at Protocol._enqueue (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql/lib/protocol/Protocol.js:129:13)
    at Connection.query (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql/lib/Connection.js:201:25)
    at update (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/QueryCache.js:72:18)
    at QueryCache.invalidate (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/QueryCache.js:119:5)
    at new LiveMysqlSelect (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:46:16)
    at LiveMysql.select (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/LiveMysql.js:100:19)
    at [object Object]._handler (server/database.js:32:21)
    at maybeAuditArgumentChecks (livedata_server.js:1698:12)
    at [object Object]._.extend._runHandler (livedata_server.js:1023:17)
    at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
    at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
    at livedata_server.js:548:43

If I connect with socket I got the error

{ [Error: connect ENOENT]
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'connect',
  fatal: true }
Exception from sub termineDetail id yb6Kh8GypDtqfgmc9 Error: Cannot enqueue Query after fatal error.
    at Object.Future.wait (/bundle/bundle/programs/server/node_modules/fibers/future.js:398:15)
    at LiveMysqlSelect.LiveMysql.LiveMysqlSelect._publishCursor (packages/numtel_mysql/packages/numtel_mysql.js:55:1)
    at [object Object]._.extend._publishHandlerResult (livedata_server.js:1065:13)
    at [object Object]._.extend._runHandler (livedata_server.js:1038:10)
    at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
    at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
    at livedata_server.js:548:43
    - - - - -
    at Protocol._validateEnqueue (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql/lib/protocol/Protocol.js:194:16)
    at Protocol._enqueue (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql/lib/protocol/Protocol.js:129:13)
    at Connection.query (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql/lib/Connection.js:201:25)
    at update (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/QueryCache.js:72:18)
    at QueryCache.invalidate (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/QueryCache.js:119:5)
    at new LiveMysqlSelect (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:46:16)
    at LiveMysql.select (/bundle/bundle/programs/server/npm/numtel_mysql/node_modules/mysql-live-select/lib/LiveMysql.js:100:19)
    at [object Object]._handler (server/database.js:33:21)
    at maybeAuditArgumentChecks (livedata_server.js:1698:12)
    at [object Object]._.extend._runHandler (livedata_server.js:1023:17)
    at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
    at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
    at livedata_server.js:548:43

Where is the problem??
Thanks for help.

@anilkhichar
Copy link

Can you please put your connection detail like settings.json and the code that is using it?

@HamburgerJungeJr
Copy link
Author

Thanks. Is this the code you mean?

Meteor.startup(function(){
  // Connection zur MySQL-DB
  var database = new LiveMysql({
    host: 'localhost',
    port: "3306",
    user: 'root',
    password: 'myrootpassword',
    database: 'ackellinghusen'
  });
  // News publisher
  Meteor.publish('news', function () {
    return database.select("SELECT * FROM tx_news_domain_model_news WHERE deleted=0 AND pid=96 ORDER BY datetime DESC", [{table: "tx_news_domain_model_news"}]);
  });

  // News-tag publisher
  Meteor.publish('newsTags', function () {
    return database.select("SELECT mm.*, tag.* FROM tx_news_domain_model_news_tag_mm as mm JOIN tx_news_domain_model_tag as tag on mm.uid_foreign=tag.uid", [{table: "tx_news_domain_model_news_tag_mm"}, {table: "tx_news_domain_model_tag"}]);
  });

  // News-tag publisher
  Meteor.publish('newsImages', function () {
    return database.select("SELECT file.identifier AS path, ref.uid_foreign AS newsId, ref.sorting_foreign AS sorting, ref.showinpreview AS isPreview FROM sys_file AS file JOIN sys_file_reference AS ref ON file.uid=ref.uid_local WHERE ref.pid=96;", [{table: "sys_file"}, {table: "sys_file_reference"}]);
  });

  // Termine publisher
  Meteor.publish('termine', function () {
    return database.select("SELECT uid, unix_timestamp(start_date) AS start_date, unix_timestamp(sec_to_time(start_time)) as start_time, title FROM tx_cal_event WHERE calendar_id=1 AND date(start_date) >= Date(now()) AND deleted=0 ORDER BY start_date ASC;", [{table:"tx_cal_event"}]);
  });

  //TerminDetail publisher
  Meteor.publish('termineDetail', function () {
    return database.select("SELECT event.uid, unix_timestamp(event.start_date) as start_date, unix_timestamp(event.end_date) as end_date, event.allday, unix_timestamp(sec_to_time(event.start_time)) as start_time, unix_timestamp(sec_to_time(event.end_time)) as end_time,event.title, event.description, organizer.name AS organizerName, location.name AS locationName, location.street AS locationStreet, location.zip as locationZip, location.city AS locationCity, location.latitude AS locationLatitude, location.longitude AS locationLongitude FROM tx_cal_event AS event LEFT JOIN tx_cal_organizer AS organizer ON event.organizer_id=organizer.uid LEFT JOIN tx_cal_location AS location ON event.location_id=location.uid;", [{table: "tx_cal_event"},{table: "tx_cal_organizer"},{table: "tx_cal_location"}]);
  });
});

I forgot to mention, that evrything works on my dev-machine. With port and with socket.

@anilkhichar
Copy link

What's your mysql version on production & dev? Is the bin log enabled on prod same way as dev ?

@anilkhichar
Copy link

As per my past experience it could be due to mysql version.

@HamburgerJungeJr
Copy link
Author

Dev

  • mysql Ver 14.14 Distrib 5.6.27, for debian-linux-gnu (i686) using EditLine wrapper
  • my.cnf
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
 log-bin=mysql-bin
 expire_logs_days = 2
server-id        = 1
binlog_format    = row

Prod

  • mysql Ver 14.14 Distrib 5.6.28, for debian-linux-gnu (x86_64) using EditLine wrapper
  • my.cnf
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
# binlog config
[mysqld]
 log-bin=mysql-bin
 expire_logs_days = 2
server-id        = 1
binlog_format    = row
#bind-address = 0.0.0.0

@anilkhichar
Copy link

Please try the below amendments and let me know if still experiencing the same error:
Application:
var database = new LiveMysql({
host: 'localhost',
port: "3306",
user: 'root',
password: 'myrootpassword',
database: 'ackellinghusen',
"serverId": 1,
"minInterval": 200
});

my.cnf:
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 2
server_id = 1
binlog_format = row
binlog_do_db = ackellinghusen
max_binlog_size = 100M

Now restart your mysql server and you will be good with your binlog enabling. Thne restart meteor application server and you should be good.

@HamburgerJungeJr
Copy link
Author

Thanks, but nothing changed

@HamburgerJungeJr
Copy link
Author

I've got the problem.

Everything works when I change localhost to the IP of my Server.
But where does this come from??

@SantoshSrinivas79
Copy link

@HamburgerJungeJr Did you use mupx to deploy or something else? My rather simple app is working on dev, but when I use mupx deploy, I am getting a ECONNREFUSED error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants