Skip to content

Setting custom puppet facts from within your Vagrantfile

You may want to set custom puppet facts in your development environment by specifying them in your Vagrantfile, so you can have a unique fact per developer or identify your own environment. Here's a quick way to do that.
Continued...

Nginx: nginx: [warn] load balancing method redefined

You may receive the following warning when reloading/configtesting an Nginx configuration that uses upstreams.

$ service nginx configtest
nginx: [warn] load balancing method redefined in /etc/nginx/conf.d/upstream.conf:5
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

This can occur when you conflicting variables inside your upstream, like such:

$ cat upstream.conf 
upstream upstream_name {
  # Use max # keepalive connections
  keepalive 120;
  # Use the backend with least number of connections
  least_conn;
  # All upstream members defined below
  server 192.168.1.5:80  weight=24;
  server 192.168.1.6:80   weight=24;
}

The warning is causde by the mixing of 'keepalive' and 'least_conn', use either one but don't mix both.

CentOS / RHEL: configure: error: C++ compiler g++ does not work or no compiler found

Probably means you're missing the g++ compiled at all, which isn't install with a groupinstall of the development tools.

configure: error: C++ compiler g++ does not work or no compiler found

Solution:

$  yum install gcc gcc-c++

And that's it.

RVM: Installing Ruby 1.8.7 on Mac OSX 10.8

Just a quick command copy/paste to remind me in the future to help compile/configure ruby 1.8.7 via RVM on Mac OSX 10.8. Continued...

Gearman Queue error: mysql_stmt_execute failed: Unknown prepared statement handler (1)

If you're running Gearman from a self-compiled version (or self-packaged version), you can run into the following error. This is the same on Ubuntu, Debian or CentOS/RHEL clones.

 [  proc ] mysql_stmt_execute failed: Unknown prepared statement handler (1) given to mysqld_stmt_execute -> libgearman-server/plugins/queue/mysql/queue.cc:356
 [  proc ] gearman_server_job_add gearman_server_run_command(QUEUE_ERROR) -> libgearman-server/server.cc:284

The above is visible from the /var/log/gearmand/gearmand.log logs, that which calls the queue will fail with an error message as such:

Warning: GearmanClient::doBackground(): _client_run_tasks(GEARMAN_SERVER_ERROR) queue_insert_error:QUEUE_ERROR -> libgearman/client.cc:1522 in /path/to/script.php on line xxx

The solution is relatively simply: you probably don't have the uuid package installed. The package is meant to generate unique IDs that Gearman would use to assign to each job, without the package the unique ID's can not be generated. If you're running a MySQL persistent backend for your Gearman, inserts would fail without such a unique ID because of primairy key violations.

As such, install it:

$ apt-get install uuid
$ yum install uuid

Depending on your OS, use either apt/yum.