So I have successfully installed and started ElasticSearch as a service in Centos 7. My question is this. After the service is started, is there a way to view the console that one would see if it didn't start ElasticSearch as a service?
An example of the console I am trying to see is below:(This is what it would have looked like if I didn't start it as a service).
Once you have started elasticsearch on console, you can check whether elasticsearch is running or not by entering following url in browser:
http://localhost:9200
By entering above url if you get a response such as:
{
"status" : 200,
"name" : "Doppelganger",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.5.2",
"build_hash" : "62ff9868b4c8a0c45860bebb259e21980778ab1c",
"build_timestamp" : "2015-04-27T09:21:06Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
It means your elasticsearch is working.
Note: If you are not running elasticsearch instance & enter the url you will find webpage is not available message.
Related
I just downloaded the new MongoDB 4.2.1, on Windows, and I just want to use it locally without authentication. I am able to run mongod plain and the server starts fine. I am able to connect to mongodb://localhost:27017, but when I try to do anything I get the error there are no users authenticated.
I never had this issue in previous versions, so I'm wondering if 4.2 now has new restrictions that authentication must be enabled or something. Is that the case?
Edit: This is a new fresh install of MongoDB, and I've uninstalled all other versions. I haven't changed the config. All I have done is create the C:/data/db directory.
Edit 2:
Here is my config file:
storage:
dbPath: C:\Program Files\MongoDB\Server\4.2\data
journal:
enabled: true
net:
port: 27017
bindIp: 127.0.0.1
Some more information from messing around. MongoDB Compass gives me the error immediately upon connecting. A nodejs application is able to connect but when attempting to write anything it gets the error.
However, in the mongo shell I am able to connect and make write operations with no issues.
There are no commands being logged, only the initial startup output which all seems normal.
db._adminCommand( {getCmdLineOpts: 1}) output:
{
"argv" : [
"C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.exe",
"--config",
"C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.cfg",
"--service"
],
"parsed" : {
"config" : "C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.cfg",
"net" : {
"bindIp" : "127.0.0.1",
"port" : 27017
},
"service" : true,
"storage" : {
"dbPath" : "C:\\Program Files\\MongoDB\\Server\\4.2\\data",
"journal" : {
"enabled" : true
}
},
"systemLog" : {
"destination" : "file",
"logAppend" : true,
"path" : "C:\\Program Files\\MongoDB\\Server\\4.2\\log\\mongod.log"
}
},
"ok" : 1
}
Well, for some reason it worked when connecting to 127.0.0.1 and not localhost. Never had that before.
I'm giving this as a "response" (instead of a "comment"), just so I can format things more clearly for you.
I happen to be running MongoDB 4.2.0 on a Linux VM, with no authentication ... and no problems.
SUGGESTIONS:
Check /etc/mongod.conf (Windows equivalent), and make sure authorizationis COMPLETELY COMMENTED OUT (vs. "authorization: disabled")
Check /var/log/mongodb/mongod.log (Windows equivalent). If you find anything "significant", please copy/paste it into your post.
In "mongo", type db._adminCommand( {getCmdLineOpts: 1}) and ensure your runtime configuration settings match what you expect them to be.
Please keep us posted what you find!
Make sure you have installed mongodb
I am trying to replicate database in mongodb 4.0 in two different windows server. I followed all the steps of mongodb replication. While I was configuring the secondary database from primary through the below command
rsconf={_id:"myset",
members:[{_id:0,host:"PrimaryServerIP:27017"},{_id:1,host:"SecondaryServerIP:27017"}]}
Then while I was reconfiguring the rsconf through
rs.reconfig(rsconf)
I was getting the below error message
"Support for replication protocol version 0 was removed in MongoDB 4.0. Downgrade to MongoDB version 3.6 and upgrade your protocol version to 1 before upgrading your MongoDB version"
I tried to update the replication protocol by downgrading the MongoDB to 3.6 through the below command
rsconf = rs.conf()
rsconf.protocolVersion=1
rs.reconfig(rsconf)
But still getting the same error message. Is there any way to update the protocol version to 1 in mongodb 4.0.
Also I tried the same replication steps in mongodb 3.6 and it is working fine. Any help will be highly appreciated.
I had a similar issue and when I added protocolVersion to my new config it worked.
rsconf={
_id:"myset",
protocolVersion: NumberLong(1),
members:[{_id:0,host:"PrimaryServerIP:27017"},{_id:1,host:"SecondaryServerIP:27017"}]
}
I was initially having this issue trying to reset my rs config to blank so I could start over; I actually did this in the mongo shell
cfg = {
"_id" : "rs0",
"version" : 2,
"protocolVersion" : NumberLong(1),
"members" : [
{
"_id" : 0,
"host" : "myhost:27017"
}
]
}
rs.reconfig(cfg, {force:true})
Using mongoDB 3.4.3 I'm facing the problem described in this issue (https://jira.mongodb.org/browse/SERVER-26556) when trying to create an index with collation.
Since I've upgraded from a previous version, it says what is needed is to explicitly allow the backwards-incompatible 3.4 features set, but with a user with role userAdminAnyDatabase I still have no permission:
> db.adminCommand({setFeatureCompatibilityVersion: "3.4"})
{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command {setFeatureCompatibilityVersion: \"3.4\" }",
"code" : 13,
"codeName" : "Unauthorized"
}
My question is, what role does the user needs to be able to do this?
Using a user with root privilege worked.
After authentication:
> use admin
> db.adminCommand({setFeatureCompatibilityVersion: "3.4"})
{ "ok" : 1 }
I was not able to run the command as I was getting the following error :
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { setFeatureCompatibilityVersion: \"3.4\", $db: \"admin\" }",
"code" : 13,
"codeName" : "Unauthorized"
}
The following link gives details :
https://dba.stackexchange.com/questions/159390/mongodb-all-commands-spit-out-not-authorized-on-admin-to-execute-command
Steps I followed (I am using Mac) :
sudo nano /usr/local/etc/mongod.conf
Comment the security as shown below:
Restart MongoDB. sudo brew services restart mongodb
Connect using mongodb and run the following code
use admin
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
Uncomment the security in mongod.conf and restart the MongoDB server.
To be able to execute setFeatureCompatibilityVersion user must have "clusterManager" built-in role.
See documentation here: https://docs.mongodb.com/manual/reference/built-in-roles/#clusterManager
Using the C# MongoDb driver, is there a way to query a server to find out if it was started with:
mongod --auth or just mongod?
Thanks.
There is a ticket on the MongoDB tracker indicating the getCmdLineOpts command can be used to get the auth mode of the server.
db.runCommand("getCmdLineOpts")
returns
{
"argv" : [
"mongod",
"--config",
"mongodb.conf"
],
"parsed" : {
"auth" : "true",
"config" : "mongodb.conf",
...
},
"ok" : 1
}
If --auth was passed on the command line it will appear in the argv and parsed nodes; if it was set in mongodb.conf it will only appear in the parsed node.
I need to grab (within the C# driver for MongoDB) a list of all the config servers connected to my instance of Mongo-s. Or, failing that, I would settle for a way to grab ALL the servers and a way to go through them one by one telling which are configsvr and which are something else. I was thinking of the getShardMap command, but I still have no idea how to look at a server (programmatically) and decide if it's a configsvr or not.
Thanks.
mongos> db.runCommand("getShardMap")
{
"map" : {
"node2:27021" : "node2:27021",
"node3:27021" : "node3:27021",
"node4:27021" : "node4:27021",
"config" : "node2:27019,node3:27019,node4:27019",
"shard0000" : "node2:27021",
"shard0001" : "node3:27021",
"shard0002" : "node4:27021"
},
"ok" : 1
}
getShardMap command gives the config string that is passed to mongos server. You can parse the string to get the list of config servers.
The only way I can think of to get this info is to run the getCmdLineOpts command on a mongos and look at the --configdb argument it was passed. I'm not sure how you run admin commands in the C# driver, but I'd imagine it's something like:
db.RunCommand("getCmdLineOpts");