Friday, May 10, 2019

Error starting Rabbitmq on MacOS

After having problems with my Homebrew I had to reinstall a few things. A month or so later I found I had forgotten to reinstall RabbitMq so I did the usual:

brew install rabbitmq

I went to:

cd /usr/local/sbin

Then I started rabbitmq:

./rabbitmq-server 


which resulted in an error:

JMBP:sbin johnroberts$ ./rabbitmq-server 

  ##  ##
  ##  ##      RabbitMQ 3.7.14. Copyright (C) 2007-2019 Pivotal Software, Inc.
  ##########  Licensed under the MPL.  See https://www.rabbitmq.com/
  ######  ##
  ##########  Logs: /usr/local/var/log/rabbitmq/rabbit@localhost.log
                    /usr/local/var/log/rabbitmq/rabbit@localhost_upgrade.log

              Starting broker...
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{{schema_integrity_check_failed,[{table_attributes_mismatch,rabbit_exchange,[name,type,durable,auto_delete,internal,arguments,scratches,policy,operator_policy,decorators,options],[name,type,durable,auto_delete,internal,arguments]}]},{rabbit,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{schema_integrity_check_failed,[{table_attributes_mismatch,rabbit_exchange,[name,type,durable,auto_delete,internal,ar


Crash dump is being written to: /usr/local/var/log/rabbitmq/erl_crash.dump...done

Looking at $PATH

echo $PATH

I noticed rabbitmq was not in there so I added it.

Still no good!

I then noticed that the error referred to a table and that the error log file referred to a database directory:

 database dir   : /usr/local/var/lib/rabbitmq/mnesia/rabbit@localhost

I had a hunch that removing rabbitmq the first time probably didn't remove the database directory and the new install was probably incompatible with what was in there.

So I uninstalled rabbitmq using
 brew uninstall rabbitmq

and noticed the db directory was still there.
So I removed the directory.

Then,
Reinstalled rabbitmq.
Started it.
And jolly good news.

  ##  ##
  ##  ##      RabbitMQ 3.7.14. Copyright (C) 2007-2019 Pivotal Software, Inc.
  ##########  Licensed under the MPL.  See https://www.rabbitmq.com/
  ######  ##
  ##########  Logs: /usr/local/var/log/rabbitmq/rabbit@localhost.log
                    /usr/local/var/log/rabbitmq/rabbit@localhost_upgrade.log

              Starting broker...

 completed with 7 plugins.


thanks




Comprehending Monads by Philp Wadler. Probably the first time Monads could be used to structure programs

If you're interested in the origins and why's of the Functional Programming idea then this is an interesting read.  In the 1960's monads were invented by Category theorists. In the 1970's Functional programmers invented list comprehensions. This paper shows how the two come together.

Why Functional Programming Matters, John Hughes The University, Glasgow



A really interesting paper by John Hughes though really quite old now.

As software becomes more and more complex, it is more and more important to structure it well. Well-structured software is easy to write and to debug, and provides a collection of modules that can be reused to reduce future programming costs. In this paper we show that two fea- tures of functional languages in particular, higher-order functions and lazy evaluation, can contribute significantly to modularity. As examples, we manipulate lists and trees, program several numerical algorithms, and implement the alpha-beta heuristic (an algorithm from Artificial Intelligence used in game-playing programs). We conclude that since modularity is the key to successful programming, functional programming offers important advantages for software development.