Following command can be used to run mongo db as service.
mongod.exe --install --dbpath "c:\mongo\data\db" --logpath "c:\mongo\data\log"
You can also set dbpath & logpath in "mongod.cfg" file and run the command as follows.
mongod.exe --install --config "c:\mongo\mongod.cfg"
Sample mongod.cfg
systemLog:
destination: file
path: C:\Program Files\MongoDB\Server\3.2\data\log\mongod.log
storage:
dbPath: C:\Program Files\MongoDB\Server\3.2\data\db
In Windows, you can stop service in services management window. Run/Services
In Linux, ps -ef|grep mongo then kill -9 process_id
Monday, June 13, 2016
Tuesday, June 7, 2016
Trust certificates in JAVA
Following trust
manager can be used to ignore validation certificate chains.
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public
java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void
checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void
checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
}
};
// Install the all-trusting trust manager
try {
SSLContext sc =
SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new
java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (GeneralSecurityException e) {
}
Subscribe to:
Posts (Atom)