Powered By Blogger

Wednesday, April 3, 2013

Unlimited number of search results in lucene


private SearchParameters getSearchParameters(final NodeRef nodeRef) {
  final SearchParameters params = new SearchParameters();
  params.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
  params.setLanguage(SearchService.LANGUAGE_LUCENE);
  params.setQuery(format(QUERY_PATTERN, ContentModel.TYPE_CONTENT, nodeRef));
  params.setLimitBy(LimitBy.UNLIMITED);
  params.setLimit(0);
  params.setMaxPermissionChecks(100000);
  params.setMaxPermissionCheckTimeMillis(100000);
  params.setMaxItems(-1);
  return params;
 }



In addition in the alfresco-global.properties we can changed below values

system.acl.maxPermissionCheckTimeMillis 
system.acl.maxPermissionCheck

to get it reflcected across the system.



Tuesday, March 5, 2013

Important files of Alfresco

Alfresco server

1. alfresco-global.properties
    alf_data location,mail related ,cluster info

2. server.xml
    ports,ssl settings
3. tomcat-users.xml
    users required for authentication
4. keystore location to configure in server.xml
5. ehcache-custom.xml
         For enabling jgroups
6.catalina.properties
         To load the shared.loader preoperty

7. alf_data tp store the contents




Share- Server

1. share-config-custom.xml
     To configure endpoint

2. catalina.properties
     To load the shared/web-extension folder

Solr server

1. solr.xml
    To provide the info on solr.war
2. solrcore.properties in each of the core
        To specify where to store the indexes.
3. keystore
        This folder will have the contents used in solr
4. tomcat-users.xml
        To support ssl
5. server.xml
        To support ssl

AlfrescoCluster


Setup For the cluster With Alfresco 4.1.2 in local machine.
Servers setup. Alfresco cluster is done in “D:\alfrescoCluster-4.1.2”.  In clustering we will use UDP since we have servers in LAN. If the servers are present in WAN then we should think of using TCP mode to replicate the cache between the nodes. In the configuration if any of the port is mentioned as “0” then free available port will be used by the system.
alf_data is been shared with both the alfresco instances as content store. It will have keystore folder, these contents will be used by node1 and node2’s server.xml.
node1 – It will have alfresco and share installed running on port 5050.
node2- It will have alfresco and share installed running on port 8080.
solrnode1 – It will be used by alfresco node2(As per config in alfresco-global.properties of node2) to store the indexes. Search from both the nodes of alfresco will access data from this node. It will have its own keystore used by server.xml of solr server.
Alfresco node1 –running on port 5050. Files to be changed are
We  can install alfresco using the installer. After the installation copy mydql-connector.jar to lib folder of alfresco. After installation delete the solr.xml from catalina.localhost folder.
Files to be Observed :
1.       alfresco-global.properties
dir.root=D:/alfrescoCluster-4.1.2/alf_data
alfresco.context=alfresco
alfresco.host=127.0.0.1
alfresco.port=5050
alfresco.protocol=http
share.context=share
share.host=127.0.0.1
share.port=5050
share.protocol=http

### database connection properties ###
#db.driver=org.postgresql.Driver
db.username=root
db.password=root
db.name=alfrescocluster
#db.url=jdbc:postgresql://localhost/alfresco
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfrescocluster?useUnicode=yes&characterEncoding=UTF-8


###############Cluster properties###########
alfresco.cluster.name=alfresco-irm-preprod
#alfresco.ehcache.rmi.hostname=al1102.patil.com
alfresco.ehcache.rmi.hostname=localhost
alfresco.ehcache.rmi.port=40001
alfresco.ehcache.rmi.remoteObjectPort=45001

######Jgroups Configuration#########

#alfresco.jgroups.bind_address=al1102.patil.com
alfresco.jgroups.bind_address=localhost
alfresco.jgroups.bind_interface=eth0

######Content store replication#########
dir.contentstore=${dir.root}/contentstore
dir.contentstore.deleted=${dir.root}/contentstore.deleted
# The location of cached content
dir.cachedcontent=${dir.root}/cachedcontent
dir.auditcontentstore=${dir.root}/audit.contentstore

2.       catalina.properties
shared.loader=${catalina.base}/shared/classes

3.       tomcat-users.xml
This will have the user details to be connected with solr
 
 

4.       server.xml
This will have the details related to ssl connection


   
               maxThreads="150" scheme="https" keystoreFile="D:\alfrescoCluster-4.1.2/alf_data/keystore/ssl.keystore" keystorePass="kT9X6oe68t" keystoreType="JCEKS"
 secure="true" connectionTimeout="240000" truststoreFile="D:\alfrescoCluster-4.1.2/alf_data/keystore/ssl.truststore" truststorePass="kT9X6oe68t" truststoreType="JCEKS"
               clientAuth="false" sslProtocol="TLS" allowUnsafeLegacyRenegotiation="true" maxSavePostSize="-1" /> 

5.       ehcache-custom.xml

   
      path="java.io.tmpdir"/>

   
   
        class="org.alfresco.repo.cache.AlfrescoCacheManagerPeerProviderFactory"
        properties="heartbeatInterval=5000,
                    peerDiscovery=automatic,
                    multicastGroupAddress=230.0.0.1,
                    multicastGroupPort=4446"
    />

  
   
  
   
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
        properties="hostName=${alfresco.ehcache.rmi.hostname},
                    port=${alfresco.ehcache.rmi.port},
                    remoteObjectPort=${alfresco.ehcache.rmi.remoteObjectPort},
                    socketTimeoutMillis=${alfresco.ehcache.rmi.socketTimeoutMillis}"
    />
   

   
        maxElementsInMemory="5000"
        eternal="true"
        timeToIdleSeconds="0"
        timeToLiveSeconds="0"
        overflowToDisk="false"
        statistics="false"
        >

               


Alfresco node2 – running on port 8080

Solr node1- running on port 7070/7443, connecting to node2 of alfresco to keep track of the indexes.

Alf_data stored outside both the alfresco nodes will be used by both the alfresco instances to store the contents. For testing I have deployed share in the same nodes of alfresco(We can deploy share in different server, share config-custom.xml needs to be updated). For share only change required is at the end point url to connect to alfresco.



Installation of Alfresco in Different servers
We can do alfresco installation with ssl and non ssl. SSL requires keystores configuration and the tomcat-users.xml configuration. Non ssl does not require these changes.
Install alfresco using installer.  We can configure to the desired database by changing alfresco-global.properties and by moving the connector jar.

Remove share.war and share dir
Remove solr.xml config file.
Remove solr and solr.backup dir from alf_data
mv alf_data to Vormetrics mount
Create symbolic link to alf_data
We have to make sure to have keystore in alf_data as it is configured in server.xml

In the alfresco-global.properties we need to update the below properties
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=7443


Configuring solr

We can configure solr with or without ssl settings, When we are using ssl setting then we need to configure separate keystore. In the default installation it uses server.xml
These files been checked in the svn


Clustering
We will be using jgroups to sync the caches. We will be using UDP protocol as we are having LAN connection. If the clustering is internet then we should go for TCP. We will use shared content store between the nodes.
Below files are affected.
Ehcache-custom.xml
Alfresco-global.properties
Configuring shared content store.

  1. Locate the ehcache-custom.xml.sample.cluster file.
  2. Copy the file to /alfresco/extension/ehcache-custom.xml.
  3. Remove the following default definition of cacheManagerPeerListenerFactory:
4.   
5.              class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
6.              properties="socketTimeoutMillis=10000"
            />
  1. Uncomment the extended definition by removing the comment lines <!-- and --!> before and after the following section:
8. 
9.              class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
10.            properties="hostName=${alfresco.ehcache.rmi.hostname},
11.            port=${alfresco.ehcache.rmi.port},
12.           
13.          remoteObjectPort=${alfresco.ehcache.rmi.remoteObjectPort},
          socketTimeoutMillis=${alfresco.ehcache.rmi.socketTimeoutMillis}" />
  1. Save the ehcache-custom.xml file.
  2. Set the following properties in the alfresco-global.properties file:
alfresco.cluster.name=alfresco-irm-preprod
alfresco.ehcache.rmi.hostname=al1102.nus.ironmountain.com
alfresco.ehcache.rmi.port=40001
alfresco.ehcache.rmi.remoteObjectPort=45001

######Jgroups Configuration#########

alfresco.jgroups.bind_address=al1102.nus.ironmountain.com
alfresco.jgroups.bind_interface=eth0

######Content store replication#########
dir.root=./alf_data
dir.contentstore=${dir.root}/contentstore
dir.contentstore.deleted=${dir.root}/contentstore.deleted
# The location of cached content
dir.cachedcontent=${dir.root}/cachedcontent
dir.auditcontentstore=${dir.root}/audit.contentstore






Tuesday, February 12, 2013

Tuesday, February 5, 2013

Solr with Alfresco

While debugging search results we need to access the url
1. http://100.6.17.30:8080/solr/
2Select admin core
3.The value entered in the query will be used to search
4. SInce alfresco has done some customisations below things should be used


http://100.6.17.30:8080/solr/alfresco/afts?q=@cm\name:alfresco&version=2.2&start=0&rows=10&indent=on


Passing query

http://100.6.17.30:8080/solr/alfresco/afts?q=@cm\:name:alfresco&version=2.2&start=0&rows=10&indent=on

http://100.6.17.30:8080/solr/alfresco/afts?q=TEXT:de*&version=2.2&start=0&rows=10&indent=on

http://100.6.17.30:8080/solr/alfresco/afts?q=TEXT:a*&version=2.2&start=0&rows=1000&indent=on


http://100.6.17.30:8080/solr/alfresco/afts?indent=on&version=2.2&q=%40cm%5C%3Aname%3Aalfresco&fq=&start=0&rows=10&fl=*%2Cscore&qt=standard&wt=standard&explainOther=&hl.fl=


To Search t* across all the sites
((PATH:"/app:company_home/st:sites/*/*//*" AND (TYPE:"cm:content" AND (t* )) ) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"

http://100.6.17.30:8080/solr/alfresco/alfresco?indent=on&version=2.2&q=%28%28PATH%3A%22%2Fapp%3Acompany_home%2Fst%3Asites%2F*%2F*%2F%2F*%22+AND+%28TYPE%3A%22cm%3Acontent%22+AND+%28t*+%29%29+%29+AND+-TYPE%3A%22cm%3Athumbnail%22+AND+-TYPE%3A%22cm%3AfailedThumbnail%22+AND+-TYPE%3A%22cm%3Arating%22%29+AND+NOT+ASPECT%3A%22sys%3Ahidden%22&fq=&start=0&rows=2000&fl=*%2Cscore&qt=standard&wt=standard&explainOther=&hl.fl=


Monday, January 14, 2013

Logs for the first time when we start solr server integrated with alfresco


Jan 14, 2013 3:14:34 PM org.apache.solr.core.SolrResourceLoader replaceClassLoader
INFO: Adding 'file:/D:/Indexes/ALFRES~1/alf_data/solr/lib/xercesImpl-2.8.0.jar' to classloader
Jan 14, 2013 3:14:46 PM org.quartz.core.SchedulerSignalerImpl
INFO: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
Jan 14, 2013 3:14:46 PM org.quartz.core.QuartzScheduler
INFO: Quartz Scheduler v.1.8.3 created.
Jan 14, 2013 3:14:46 PM org.quartz.simpl.RAMJobStore initialize
INFO: RAMJobStore initialized.
Jan 14, 2013 3:14:46 PM org.quartz.core.QuartzScheduler initialize
INFO: Scheduler meta-data: Quartz Scheduler (v1.8.3) 'SolrTrackerScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

Jan 14, 2013 3:14:46 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler 'SolrTrackerScheduler' initialized from an externally provided properties instance.
Jan 14, 2013 3:14:46 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler version: 1.8.3
Jan 14, 2013 3:14:46 PM org.quartz.core.QuartzScheduler start
INFO: Scheduler SolrTrackerScheduler_$_NON_CLUSTERED started.
Jan 14, 2013 3:14:46 PM org.apache.solr.core.SolrResourceLoader
INFO: Solr home set to 'D:\Indexes\ALFRES~1\alf_data\solr\workspace-SpacesStore\'
Jan 14, 2013 3:14:47 PM org.apache.solr.core.SolrConfig initLibs
INFO: Adding specified lib dirs to ClassLoader
Jan 14, 2013 3:14:48 PM org.apache.solr.core.SolrConfig
INFO: Loaded SolrConfig: solrconfig.xml
Jan 14, 2013 3:14:48 PM org.apache.solr.schema.IndexSchema readSchema
INFO: Reading Solr Schema
Jan 14, 2013 3:14:48 PM org.apache.solr.schema.IndexSchema readSchema
INFO: Schema name=alfresco
Jan 14, 2013 3:14:48 PM org.apache.solr.util.plugin.AbstractPluginLoader load
INFO: created null: org.apache.solr.analysis.WhitespaceTokenizerFactory
Jan 14, 2013 3:14:48 PM org.apache.solr.util.plugin.AbstractPluginLoader load
INFO: created null: org.apache.solr.analysis.WordDelimiterFilterFactory
Jan 14, 2013 3:14:48 PM org.apache.solr.util.plugin.AbstractPluginLoader load
INFO: created null: org.apache.solr.analysis.LowerCaseFilterFactory
Jan 14, 2013 3:14:48 PM org.apache.solr.util.plugin.AbstractPluginLoader load
INFO: created alfrescoDataType: org.alfresco.solr.AlfrescoDataType
Jan 14, 2013 3:14:48 PM org.apache.solr.core.SolrCore initIndex
WARNING: [alfresco] Solr index directory 'D:\Indexes\ALFRES~1\alf_data\solr\workspace\SpacesStore\index' doesn't exist. Creating new index...
Jan 14, 2013 3:14:50 PM org.apache.solr.handler.component.SpellCheckComponent inform
WARNING: No queryConverter defined, using default converter
Jan 14, 2013 3:14:51 PM org.apache.solr.core.SolrCore initIndex
WARNING: [archive] Solr index directory 'D:\Indexes\ALFRES~1\alf_data\solr\archive\SpacesStore\index' doesn't exist. Creating new index...
Jan 14, 2013 3:14:51 PM org.apache.solr.handler.component.SpellCheckComponent inform
WARNING: No queryConverter defined, using default converter
Jan 14, 2013 3:14:51 PM org.apache.catalina.startup.HostConfig deployWAR

Friday, January 11, 2013

Connecting to remote server

http://www.mremoteng.org/home

This is the tool for connecting to remote server