Archive for ServerSide

mongoCloud state of thoughts

we use mongoCloud(previously MMS) in production for half a year now.
tried both Modulus and Compose meanwhile – no good for our needs.. and alot less flexibility.

some info:
~ monitoring and backup agents can be set up on a separate instance.. no need to install them on all the hosts.
+ there is a nice “scoring” system that notifies you via email how secure your mongo deployments are
– I am messing with arbiters now… short tip – don’t use them for now, as they can not be promoted to secondaries. just 1pri and 2sec
– you can not “easily” control ports that mongoCloud will use when deploying new hosts (just breaks my own naming convention :/ )

also.. use ReplicaSets.. always.. even with 1 host – this will save you some time when/if you’ll decide to add a couple more hosts to a cluster

and as a separate question: I am wondering will Meteor-MognoDB-Client auto-discover new(added/modified) MongoDB hosts without changing MONGO_URL(i.e. adding mongohost4:27002)?

regexp: ADD CONSTRAINT to DROP FOREIGN KEY

if you have something like

ALTER TABLE `accounts_purchases`
  ADD CONSTRAINT `accounts_purchases_account` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `accounts_purchases_item` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

and you are about to update those constraints:
You have to drop them first, by getting all their “symbols”…

here is a “simple” regexp to modify SQL export to DROPs Read more

MySQL: Truncate DB Tables with Constraints

To truncate db Tables with some “linked” data might not be that obvious Task. Foreign Keys always try to interrupt your process.

You can TRUNCATE tables one by one in the correct order. i.e. from “children” to “parents”.
But sometimes this is not possible due to child-parent relations inside the table itself.

so here is a quick tip: Read more

MySQL TEXT, MEDIUMTEXT, LONGTEXT, TINYTEXT limits

A MySQL TEXT field can store much more data than more often used VARCHARS.
However, sometimes this is not enough, and MySQL starts to truncate those big TEXT streams on insert or update.

According to MySQL 5.6 documentation:

      Type | Maximum length                          | Max UTF-8 chars
-----------+-----------------------------------------+-----------------
  TINYTEXT |           255 ( 2^8 - 1) bytes          |              84
      TEXT |        65,535 (2^16 - 1) bytes = 64 KiB |          21,844
MEDIUMTEXT |    16,777,215 (2^24 - 1) bytes = 16 MiB |       5,592,404
  LONGTEXT | 4,294,967,295 (2^32 - 1) bytes =  4 GiB |   1,431,655,764

UTF-8 characters can require up to 3 bytes per character.
Note that the number of *characters* that can be stored in your column will depend on the *character encoding*.

So, keep in mind, how MANY chars you’d like to store and pick text-field type properly.
And, also, verify the length of the data that you try to store.

Unable to resize ec2 ebs root volume

I have followed many of the tutorials that pretty much all say the same thing which is basically:

1. Stop the instance
2. Detach the volume
3. Create a snapshot of the volume
4. Create a bigger volume from the snapshot
5. Attach the new volume to the instance
6. Start the instance back up
7. Run resize2fs /dev/xxx

However, step 7 is where the problems start happening. Read more