[SERVER-3876] Adding SECONDARY server to replica set Created: 15/Sep/11  Updated: 11/Jul/16  Resolved: 15/Sep/11

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 1.8.3
Fix Version/s: None

Type: Question Priority: Minor - P4
Reporter: Leonid Mikityanskiy Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 2.6.18-238.12.1.el5 #1 SMP Sat May 7 20:18:50 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux


Backwards Compatibility: Fully Compatible
Participants:

 Description   

I am setting up replica set.
On master:
replSet = rs2 added to config file
~~~
> rs.initiate()
{
"info2" : "no configuration explicitly specified – making one",
"info" : "Config now saved locally. Should come online in about a minute.",
"ok" : 1
}
rs2:PRIMARY> db.unicorns.find(

{name: 'Horny'}

);
<', dob: new Date(1992,2,13,7,47), loves: ['carrot','papaya'], weight: 600, gender: 'm', vampires: 63});
rs2:PRIMARY> db.unicorns.find(

{name: 'Horny'}

);

{ "_id" : ObjectId("4e723bcffa1ff8e3080494cf"), "name" : "Horny", "dob" : ISODate("1992-03-13T12:47:00Z"), "loves" : [ "carrot", "papaya" ], "weight" : 600, "gender" : "m", "vampires" : 63 }

rs2:PRIMARY>
rs2:PRIMARY> rs.status()
{
"set" : "rs2",
"date" : ISODate("2011-09-15T17:57:48Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "SD2QVQ01VL:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"optime" :

{ "t" : 1316109264000, "i" : 1 }

,
"optimeDate" : ISODate("2011-09-15T17:54:24Z"),
"self" : true
}
],
"ok" : 1
}
rs2:PRIMARY>
~~~
On slave :
replSet = rs2 added to config file
~~
> rs2.add("SD2QVQ01VL:27017");
Thu Sep 15 14:25:04 ReferenceError: rs2 is not defined (shell):1
~~~
Ping SD2QVQ01VL shows
64 bytes from SD2QVQ01VL.SAKSDIRECT.COM (10.32.150.82): icmp_seq=2 ttl=64 time=0.194 ms

What is wrong in my setup?
Thanks in advance.
Leonid M.



 Comments   
Comment by Kristina Chodorow (Inactive) [ 15/Sep/11 ]

Cool, you're welcome.

Comment by Leonid Mikityanskiy [ 15/Sep/11 ]

Now it is OK. I ran rs.add('SD2QVQ02VL') on primary
And data was replicate from master to slave.
Thanks for your help.
Leonid M.

Comment by Kristina Chodorow (Inactive) [ 15/Sep/11 ]

What server is the shell connected to? You have to be connected to the replica set primary to run rs.add.

Comment by Leonid Mikityanskiy [ 15/Sep/11 ]

I did it and
~~
> rs.add("SD2QVQ01VL:27017");
assert failed : no config object retrievable from local.system.replset
Error("Printing Stack Trace")@:0
()@shell/utils.js:21
("assert failed : no config object retrievable from local.system.replset")@shell/utils.js:32
(null,"no config object retrievable from local.system.replset")@shell/utils.js:42
("SD2QVQ01VL:27017")@shell/utils.js:1335
@(shell):1

Thu Sep 15 15:22:47 uncaught exception: assert failed : no config object retrievable from local.system.replset
>
~~
Thanks.
Leonid M.

Comment by Kristina Chodorow (Inactive) [ 15/Sep/11 ]

You need to run rs.add("SD2QVQ01VL:27017");, not rs2. "rs" is a shell global with a bunch of replica set helper functions. "rs2" doesn't exist in the shell.

Generated at Thu Feb 08 03:04:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.