Daniel W | 1 Aug 02:11 2011
Picon

Re: Replica Sets, failover, and drivers: try-except everything?

Thank you, this was seriously helpful!

On Jul 31, 6:42 am, GVP <gate...@...> wrote:
> So first off, you should try / except all database code. From the $m =
> new Mongo() right through to the save.
>
> > Is there a better way?
>
>  <at> Daniel: it depends. It's really about how you want to fail.
>
> You may be just fine with accepting outright failure and returning it
> to the UI: "your action failed, please try again". You may want to
> retry for a couple of seconds and then fail to the UI.
>
> Your code sample actually needs a timeout on the "waiting". A regular
> replica set fail-over will take a couple of seconds. But if something
> goes really wrong you don't want your web server in an infinite loop
> stacking up connections.
>
> > Am I overthinking this?
>
> Depending on your concern for write safety, you may be "underthinking"
> this.
>
> For example, you're using replica sets, but you have "safe=true". This
> only guarantees that the write was applied to the Primary. Python &
> PHP also have "w=n" parameter which ensures that data is replicated to
> a certain number of nodes before returning.
>
> With "safe=true", there's a possibility that your web server receives
(Continue reading)

Eliot Horowitz | 1 Aug 04:34 2011

Re: Installation problem on Linux

Can you send the contents of the logs?

If there are no logs - then there are probably permissions problems logging.

On Sun, Jul 31, 2011 at 3:22 PM, Florian Guérin <floriang33-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi,

I'm trying to install mongodb on Fedora 15 and i have little problem
when i start playing with shell console.
When i use find() i have no answer i just can do ctrl+c for escape and
i really dont understand why.

Here are the steps I followed :

# yum install mongodb mongodb-server
# mkdir -p /data/db
# chown `id -u` /data/db

# service mongod start
# mongo
connecting to : test
> j = { a : 1, b : 3}
{ "a" : 1, "b" : 3 }
> k = { a : 2, b : 3}
{ "a" : 2, "b" : 3 }
> db.test.save(j)
> db.test.save(k)
> db.test.find()
||| here no answer next step is ctrl+c

---------------------------------------------------------

My mongodb.conf file
# mongodb.conf

#where to log
logpath=/var/log/mongodb/mongodb.log

# fork and run in background
fork = true

bind_ip = 127.0.0.1
port = 27017

dbpath=/var/lib/mongodb

pidfilepath=/var/run/mongodb/mongodb.pid

# Enables periodic logging of CPU utilization and I/O wait
#cpu = true

# Turn on/off security.  Off is currently the default
#noauth = true
#auth = true

# Verbose logging output.
#verbose = true

# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true

# Enable db quota management
#quota = true

# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#oplog = 0

# Diagnostic/debugging option
#nocursors = true

# Ignore query hints
#nohints = true

# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true

# Turns off server-side scripting.  This will result in greatly
limited
# functionality
#noscripting = true

# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true

# Disable data file preallocation.
#noprealloc = true

# Specify .ns file size for new databases.
# nssize = <size>

# Accout token for Mongo monitoring server.
#mms-token = <token>

# Server name for Mongo monitoring server.
#mms-name = <server-name>

# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>

# Replication Options

# in replicated mongo databases, specify here whether this is a slave
or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com

# Address of a server to pair with.
#pairwith = <server:port>
# Address of arbiter server.
#arbiter = <server:port>
# Automatically resync if slave data is stale
#autoresync
# Custom size for replication operation log.
#oplogSize = <MB>
# Size limit for in-memory storage of op ids.
#opIdMem = <bytes>

-----------------------------------------

Finally i looked logs but no way.
What can i do?

Sorry if my english is not really well.

Thanks,

Florian.

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To unsubscribe from this group, send email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
BrianGruber | 1 Aug 06:13 2011
Picon

Excessive Disc Space for Replica Set

New to mongodb so if this is obvious, sorry.

I have a replica set with 3 servers.... one of my collections is ~2GB
based on a totalSize() stat.

HOWEVER, the actual disc space that seems to get used if I go to the
data directory is like 6 times that because I see a bunch of .0 .1 .2 .
3 .4 files
each going up to 2GB eventually for each file any ideas??

Having a 30 GB shared host and thinking I have more than enough disc
space for data/indexes/etc... but all my collections seem to have the
same issue, so I end up running out of disc space very quickly. Any
ideas??

Nat | 1 Aug 06:40 2011
Picon

Re: Excessive Disc Space for Replica Set

check this out first....
http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

Nat | 1 Aug 08:11 2011
Picon

Re: Problem Installing the PHP Driver on Hostmonster

You probably should ask admin at hostmonster to do it for you if sudo is not supported.
-----Original Message-----
From: njsuperfreak <jeffery.vincent@...>
Sender: mongodb-user@...
Date: Sun, 31 Jul 2011 11:28:01 
To: mongodb-user<mongodb-user@...>
Reply-To: mongodb-user@...
Subject: [mongodb-user] Problem Installing the PHP Driver on Hostmonster

Greetings,

I am getting the following error when I run the "pecl install mongo"
command:

Cannot install, php_dir for channel "pecl.php.net" is not writeable by
the current user

I am trying to follow the steps outlined here:
http://www.mongodb.org/display/DOCS/PHP+Language+Center

I have the following permisions on my mongodb folder:
drwxr-xr-x  mongodb-linux-x86_64-static-legacy-1.8.2/

Also I was informed by Hostmonster that "sudo" user is not supported
because I am on a shared machine and is not needed.

Please help!

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

BrianGruber | 1 Aug 08:50 2011
Picon

PHP Driver seems to block and timeout if one of the servers is down in a replicaset

Still investigating this, but I keep reproducing it:

SUMMARY:
- I have 3 different servers running in a replica set.
- I am also running 2 separate web servers running php/lighttpd

PROBLEM:
- If I kill one of the mongo servers the replica set does a good job
at picking a new master, but my PHP scripts seem to hang and that
eventually just kills the web servers :(

Here is the PHP code used to connect (IPs are fake):

$dsn = 'mongodb://123.45.67.8, 123.45.67.9, 123.45.67.0';
$m = new Mongo($dsn, array("replicaSet" => "set"));

So, if I kill off one of those IPs then PHP seems to just hang and
then my server eventually can't keep up.

Am I doing something wrong or not understanding the php connection? I
thought it would pick a usable one quickly.

BrianGruber | 1 Aug 08:55 2011
Picon

Re: Excessive Disc Space for Replica Set

I guess it's just the preallocated space. Oh well. Guess I'll get a
bigger box :)

On Jul 31, 11:40 pm, Nat <nat.lu...@...> wrote:
> check this out first....http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Florian Guérin | 1 Aug 09:04 2011
Picon

Re: Installation problem on Linux

Hi,

Thank you for reply. Yes there was  no logs. But I found.  I removed mongodb and mongodb-server and added 10gen repo and now i have no problem.
Thank you for help. :)

Le 1 août 2011 04:34, "Eliot Horowitz" <eliot-Ot75HdpNzd8AvxtiuMwx3w@public.gmane.org> a écrit :
> Can you send the contents of the logs?
> If there are no logs - then there are probably permissions problems logging.
>
> On Sun, Jul 31, 2011 at 3:22 PM, Florian Guérin <floriang33-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:
>
>> Hi,
>>
>> I'm trying to install mongodb on Fedora 15 and i have little problem
>> when i start playing with shell console.
>> When i use find() i have no answer i just can do ctrl+c for escape and
>> i really dont understand why.
>>
>> Here are the steps I followed :
>>
>> # yum install mongodb mongodb-server
>> # mkdir -p /data/db
>> # chown `id -u` /data/db
>>
>> # service mongod start
>> # mongo
>> connecting to : test
>> > j = { a : 1, b : 3}
>> { "a" : 1, "b" : 3 }
>> > k = { a : 2, b : 3}
>> { "a" : 2, "b" : 3 }
>> > db.test.save(j)
>> > db.test.save(k)
>> > db.test.find()
>> ||| here no answer next step is ctrl+c
>>
>> ---------------------------------------------------------
>>
>> My mongodb.conf file
>> # mongodb.conf
>>
>> #where to log
>> logpath=/var/log/mongodb/mongodb.log
>>
>> # fork and run in background
>> fork = true
>>
>> bind_ip = 127.0.0.1
>> port = 27017
>>
>> dbpath=/var/lib/mongodb
>>
>> pidfilepath=/var/run/mongodb/mongodb.pid
>>
>> # Enables periodic logging of CPU utilization and I/O wait
>> #cpu = true
>>
>> # Turn on/off security. Off is currently the default
>> #noauth = true
>> #auth = true
>>
>> # Verbose logging output.
>> #verbose = true
>>
>> # Inspect all client data for validity on receipt (useful for
>> # developing drivers)
>> #objcheck = true
>>
>> # Enable db quota management
>> #quota = true
>>
>> # Set oplogging level where n is
>> # 0=off (default)
>> # 1=W
>> # 2=R
>> # 3=both
>> # 7=W+some reads
>> #oplog = 0
>>
>> # Diagnostic/debugging option
>> #nocursors = true
>>
>> # Ignore query hints
>> #nohints = true
>>
>> # Disable the HTTP interface (Defaults to localhost:27018).
>> #nohttpinterface = true
>>
>> # Turns off server-side scripting. This will result in greatly
>> limited
>> # functionality
>> #noscripting = true
>>
>> # Turns off table scans. Any query that would do a table scan fails.
>> #notablescan = true
>>
>> # Disable data file preallocation.
>> #noprealloc = true
>>
>> # Specify .ns file size for new databases.
>> # nssize = <size>
>>
>> # Accout token for Mongo monitoring server.
>> #mms-token = <token>
>>
>> # Server name for Mongo monitoring server.
>> #mms-name = <server-name>
>>
>> # Ping interval for Mongo monitoring server.
>> #mms-interval = <seconds>
>>
>> # Replication Options
>>
>> # in replicated mongo databases, specify here whether this is a slave
>> or master
>> #slave = true
>> #source = master.example.com
>> # Slave only: specify a single database to replicate
>> #only = master.example.com
>> # or
>> #master = true
>> #source = slave.example.com
>>
>> # Address of a server to pair with.
>> #pairwith = <server:port>
>> # Address of arbiter server.
>> #arbiter = <server:port>
>> # Automatically resync if slave data is stale
>> #autoresync
>> # Custom size for replication operation log.
>> #oplogSize = <MB>
>> # Size limit for in-memory storage of op ids.
>> #opIdMem = <bytes>
>>
>> -----------------------------------------
>>
>> Finally i looked logs but no way.
>> What can i do?
>>
>> Sorry if my english is not really well.
>>
>> Thanks,
>>
>> Florian.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "mongodb-user" group.
>> To post to this group, send email to mongodb-user <at> googlegroups.com.
>> To unsubscribe from this group, send email to
>> mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>> For more options, visit this group at
>> http://groups.google.com/group/mongodb-user?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To unsubscribe from this group, send email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
BrianGruber | 1 Aug 09:34 2011
Picon

Re: PHP Driver seems to block and timeout if one of the servers is down in a replicaset

After more testing, it DOESN'T happen if I simply stop the service on
one of the servers with service mongod stop.
It happens if I take down the server so that it isn't online at all.

I am using PRIVATE IPs for the connections.

On Aug 1, 1:50 am, BrianGruber <webbr...@...> wrote:
> Still investigating this, but I keep reproducing it:
>
> SUMMARY:
> - I have 3 different servers running in a replica set.
> - I am also running 2 separate web servers running php/lighttpd
>
> PROBLEM:
> - If I kill one of the mongo servers the replica set does a good job
> at picking a new master, but my PHP scripts seem to hang and that
> eventually just kills the web servers :(
>
> Here is the PHP code used to connect (IPs are fake):
>
> $dsn = 'mongodb://123.45.67.8, 123.45.67.9, 123.45.67.0';
> $m = new Mongo($dsn, array("replicaSet" => "set"));
>
> So, if I kill off one of those IPs then PHP seems to just hang and
> then my server eventually can't keep up.
>
> Am I doing something wrong or not understanding the php connection? I
> thought it would pick a usable one quickly.

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Fontana | 1 Aug 09:40 2011
Picon

Re: MongoDB C# Client Save Method

Thanks for the reply,
You're right that in this case I know that the documents are new,
but there might be some other cases when I'll need to update and I
don't want the client to distinguish between them.
I noticed that there is a save() function on the server API. Why
doesn't the client call it?
Is it because it implements the same logic you described? (check if
_id is null and call insert or update accordingly)

Thanks,
--Idan.

On Jul 31, 6:36 pm, Robert Stam <rstam10...@...> wrote:
> I'm not sure exactly how the Save method worked in the samus driver,
> but here's how it works in the 10gen C# driver:
>
> 1. If the driver can tell for sure it's a new document it calls Insert
> 2. Otherwise, the driver calls Update with Upsert flag
>
> The only way the driver can know for sure that it's a new document is
> if you leave the _id field uninitialized. Since you are setting the
> _id field in your application, the driver has no way of knowing
> whether it's a new document or not, and that's why it calls Update.
>
> From your description, since you know the documents are new, you can
> just call Insert directly instead of Save.
>
> On Jul 31, 11:19 am, Fontana <idan.am...@...> wrote:
>
>
>
>
>
>
>
> > Hi,
> > I recently updated my MongoDB server to version 1.8.2, and change my
> > client to use 10gen official client (1.1).
> > I have 2 capped collections in a single DB, with sizes 200MB and
> > 800MB.
> > Before I updated the client I used to call the save method (in the old
> > client I used samus/mongodb-csharp), and the save ran fast and
> > performed only insert to the collections. (the "_id" field is unique
> > for each save operation)
> > The problem I'm having now, when using the new client, is that the
> > save method takes lots of time. When I checked the mongoDB logs I
> > noticed that I have lots of updates and no inserts.
> > The items I'm saving all have unique "_id" field (set by the
> > application) and should perform insert not update.
> > BTW, I'm saving a BsonDocument with 3 fields: "_id"(long),
> > "v"(binary), "dt"(DateTime)
> > Any ideas?
>
> > Thanks,
> > --Idan.
>
> > I attached the stats() for both collections if it can help:
>
> > {
> >         "ns" : "MyDB.MyCollection1",
> >         "count" : 147644,
> >         "size" : 121005472,
> >         "avgObjSize" : 819.5759529679499,
> >         "storageSize" : 200000256,
> >         "numExtents" : 1,
> >         "nindexes" : 0,
> >         "lastExtentSize" : 200000256,
> >         "paddingFactor" : 1,
> >         "flags" : 0,
> >         "totalIndexSize" : 0,
> >         "indexSizes" : {
>
> >         },
> >         "capped" : 1,
> >         "max" : 2147483647,
> >         "ok" : 1
>
> > }
>
> > {
> >         "ns" : "MyDB.MyCollection2",
> >         "count" : 22784,
> >         "size" : 799495352,
> >         "avgObjSize" : 35090.21032303371,
> >         "storageSize" : 800000256,
> >         "numExtents" : 1,
> >         "nindexes" : 0,
> >         "lastExtentSize" : 800000256,
> >         "paddingFactor" : 1,
> >         "flags" : 0,
> >         "totalIndexSize" : 0,
> >         "indexSizes" : {
>
> >         },
> >         "capped" : 1,
> >         "max" : 2147483647,
> >         "ok" : 1
>
> > }

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Gmane