Solr installation comands
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
apt-get install openjdk-11-jdk -y
wget https://dlcdn.apache.org/solr/solr/9.5.0/solr-9.5.0.tgz
tar xzf solr-9.5.0.tgz solr-9.5.0/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-9.5.0.tgz
http://127.0.0.1:8983/solr/#/
Create New core to host data inside it
sudo su - solr -c "/opt/solr/bin/solr create -c core_catalog_metadata_v2 -n data_driven_schema_configs"
Define Core Schema
Add your Fields schema inside managed-schema file found in path
/var/solr/data/core_catalog_metadata_v2/conf
Sample of fields that we can add
<field name="status_id" type="pint" docValues="true" indexed="true" stored="false" />
<field name="description" type="text_general" multiValued="false" indexed="false" stored="true"/>
<field name="Comments" type="text_ar" indexed="true" stored="false" omitNorms="true" />
Define new Datatype that support Arabic
<field name="FullName" type="text_ar_sort" multiValued="false" docValues="true" indexed="true" stored="true"/>
<fieldType name="text_ar_sort" class="solr.SortableTextField" sortMissingLast="true" docValues="true" positionIncrementGap="100" multiValued="false">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_ar.txt" ignoreCase="true"/>
<filter class="solr.ArabicNormalizationFilterFactory"/>
<filter class="solr.ArabicStemFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="lang/stopwords_ar.txt" ignoreCase="true"/>
<filter class="solr.ArabicNormalizationFilterFactory"/>
<filter class="solr.ArabicStemFilterFactory"/>
<filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
Solr Security
by default solr will listen to local calls only, to allow access:
nano /etc/default/solr.in.sh
listen to 0.0.0.0
Restrict network access to specific hosts, by activate Ubuntu firewall
sudo ufw enable
sudo ufw default deny incoming
sudo ufw allow OpenSSH
reboot
Add white list IPs that can access Solr
for ip in 193.199.247.17 193.42.243.96 193.35.34.22 193.59.15.7 193.89.167.125 193.59.21.206 193.189.32.185;
do
sudo ufw allow proto tcp from $ip to any port 8983 comment "Allow access to port 8983 from $ip";
done
View Firewall Status
sudo ufw status verbose
Allow new IP to access Solr
sudo ufw allow proto tcp from 193.35.116.116 to any port 8983 comment "Allow access to port 8983 from 193.35.116.116"
No comments:
Post a Comment