Skip to main content

Posts

Manage Log Files With Logrotate in Ubuntu

You need to install logratate  Sudo apt-get update Sudo apt-get install logrotate For confirm logrotate successfully installed or not run : logrotate Default logrotate configuration are present in : /etc/logrotate.conf Example :  /var/log/tomcat7/catalina.out {      copytruncate       weekly       rotate 52       compress       missingok       create 640 tomcat7 adm       size 5M } What does it means : Copytruncate : Truncate  the  original  log  file  to  zero size in place after creating a  copy,  instead  of  moving  the  old  log  file  and  optionally creating a new one.  It can be used when some program cannot be told to close its  logfile  and  thus  might  c...

How To Set Up Multiple SSL Certificates with Nginx on Ubuntu

You can host multiple SSL certificates on one IP Address using Server Name Identification (SNI). SNI ? Although hosting several sites on a single virtual private server is not a challenge with the use of virtual hosts, providing separate SSL certificates for each site traditionally required separate IP addresses. The process has recently been simplified through the use of Server Name Indication (SNI), which sends a site visitor the certificate that matches the requested server name. SNI can only be used for serving multiple SSL sites from your web server and is not likely to work at all on other daemons, such as mail servers, etc. There are also a small percentage of older web browsers that may still give certificate errors. Wikipedia has an updated list of software that does and does not support this TLS extension. Setting Up SNI does need to have registered domain names in order to serve the certificates. The steps in this tutorial require the user to have root privileges. You can ...
 Text Search In MongoDB One of the most important  feature in mongodb 10gen in version 2.4 is text search. configure text search in the mongo shell as: db.adminCommand( { setParameter : 1, textSearchEnabled : true } ) Or set a command: mongod --setParameter textSearchEnabled=true For Simple Example And More About text search in mongoDB kindly Visit  : - http://blog.mongodb.org/post/40513621310/mongodb-text-search-experimental-feature-in-mongodb?mkt_tok=3RkMMJWWfF9wsRohvKvOZKXonjHpfsX87ektW6S%2BlMI%2F0ER3fOvrPUfGjI4GTMphI%2FqLAzICFpZo2FEJSueQcg%3D%3D

Mongodb Query Optimization

Have slow database queries? Get more information on the performance of your queries using the explain feature. Using the mongo shell, invoke the explain() method on a cursor: > db.collection.find(query). explain() example : > db.user.find().explain(); The result will be a document that contains the explain output: {    "cursor" : "BasicCursor",    "indexBounds" : [ ],    "nscanned" : 57594,    "nscannedObjects" : 57594,    "nYields" : 2 ,    "n" : 3 ,    "millis" : 108,    "indexOnly" : false,    "isMultiKey" : false,    "nChunkSkips" : 0 } For More Detail visit : http://docs.mongodb.org/ manual/reference/explain/ Cheers  !!!!!!!!!!!!!!!!!
Why we Use MongoDB? Here is some highlights:- For more kindly visit  mongodb site:- http://www.mongodb.org/display/DOCS/Introduction Document-oriented Dynamically-typed (schemaless) for easy schema evolution Embedded documents and arrays reduce need for joins Documents (objects) map nicely to programming language data types High performance Indexes including indexing of keys from embedded documents and arrays Optional streaming writes (no acknowledgements) No joins and embedding makes reads and writes fast High availability Easy scalability Eventually-consistent reads can be distributed over replicated servers Automatic sharding (auto-partitioning of data across servers) Reads and writes are distributed over shards No joins or multi-document transactions make distributed queries easy and fast Rich query language
How to get Data in sorted form in spring mongodb Create Query Object and pass your Query Criteria into Query Query query=new Query (criteria); Then Query.sort().on(“sortOnTheBasicOf”, Order . ASCENDING ); Order. ASCENDING for get result in asending order and Order . DESCENDING to get result in Desending order.. sortOnTheBasicOf à Pass the entity name by which you want to sort Pass this query to Your Mangotemplate and Your Class from which You want to get Result  mongoTemplate.find(query, YourEntityClassName.class); Then You Got Desired Out put Cheers !!!!!!!!!!!!!!!!!

How To Use Map Reduce in Spring Mongo data

Suppose  I have order table and I want to find out best five selling product. Create a method that returns best product of ValueObject Type . ValueObject Type basically contain id and corresponding values to those ids as shown below: public class ValueObject implements Comparable<ValueObject>{ private Object id; private int value; public Object getId() { return id; } public void setId(Object id) { this.id = id; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } @Override public String toString() { return "ValueObject [id=" + id + ", value=" + value + "]"; } @Override public int compareTo(ValueObject o) { if(o instanceof ValueObject){ return o.getValue()-this.getValue(); } else{ throw new ClassCastException(); } } } Now, you can call mapReduce method on MongoTemplate which retur...