I'm creating a node in a MongoDB replica set
that furnishes a) an arbiter, b) a configsvr
and c) a sharding router. Unfortunately, as
the binary that implements the arbiter and
the configsvr are one and the same (mongod)
and it cannot be multiply loaded, the
customary action is to make a copy of it.
This sort of thing is only done on testing
instances (not in production).
So, one recipe installs MongoDB via the
Debian package. mongod is on the path
/usr/bin/mongod
and I want to make a copy of it on the path
/data/mongodb/bin/mongd. My
configsvr.rb
recipe ends with this:
# Copy
/usr/bin/mongod to
/data/mongodb/bin/mongod because a
separate copy
# must exist in order for the
configuration server's mongod
instance not
# to conflict with the arbiter's
instance. This copy will be
referenced by
# /etc/init/mongodb-configsvr.conf.
file "/data/mongodb/bin/mongod" do
action :create
owner "mongodb"
group "mongodb"
mode 00755
content IO.read( "/usr/bin/mongod"
)
end
Sadly, this only creates a zero-length file.
I'm guessing this will be a Chef
anti-pattern and I do want to hear the
cat-calls, but I'd also like a solution.
Profuse thanks for reading this.
Best,
Russ