Name script and update doc

This commit is contained in:
Michael RICOIS 2015-09-07 07:39:55 +00:00
parent bf06874aae
commit ac29ef9023
7 changed files with 46 additions and 72 deletions

64
README
View File

@ -1,46 +1,46 @@
How to Use
==========
USAGE
=====
Sphinx Engine configuration
---------------------------
Create a /etc/sphinxsearch/sphinx.conf
See in scripts/build/config-*
sphinx.conf : Sphinx Engine config
*.conf : one file per index
* Concat only needed file
Create a /etc/sphinxsearch/sphinx.conf
See in scripts/build/config-*
sphinx.conf : Sphinx Engine config
*.conf : one file per index
Table rotation is use with some index
Indexing
--------
indexer-*
slave-*
reprise-*
indexer-* : Index on master database with rotation
slave-* : Index on slave database only if table have rotate
manual-* : Manually reload index
Ubuntu PPA repository
=====================
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:builds/sphinxsearch-rel22
sudo apt-get install libstemmer0d
sudo apt-get update && apt-get install sphinxsearch
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:builds/sphinxsearch-rel22
sudo apt-get install libstemmer0d
sudo apt-get update && apt-get install sphinxsearch
Manual installation
===================
htop
bwm-ng
mysql-client-5.5
gcc g++ make libmysqld-dev
wget -nv -O - http://snowball.tartarus.org/dist/libstemmer_c.tgz | tar zx
wget -nv -O - https://re2.googlecode.com/files/re2-20140304.tgz | tar zx
wget http://sphinxsearch.com/files/sphinx-2.2.7-release.tar.gz
tar xzvf sphinx-2.2.7-release.tar.gz
cp -R libstemmer_c/* sphinx-2.2.7-release/libstemmer_c/
sed -i -e 's/stem_ISO_8859_1_hungarian/stem_ISO_8859_2_hungarian/g' sphinx-2.2.7-release/libstemmer_c/Makefile.in
cp -R re2/* sphinx-2.2.7-release/libre2/
cd sphinx-2.2.7-release
./configure --with-libstemmer --with-re2 --prefix=/usr/local/sphinx
make
make install
mysql-client-5.5
gcc g++ make libmysqld-dev
wget -nv -O - http://snowball.tartarus.org/dist/libstemmer_c.tgz | tar zx
wget -nv -O - https://re2.googlecode.com/files/re2-20140304.tgz | tar zx
wget http://sphinxsearch.com/files/sphinx-2.2.7-release.tar.gz
tar xzvf sphinx-2.2.7-release.tar.gz
cp -R libstemmer_c/* sphinx-2.2.7-release/libstemmer_c/
sed -i -e 's/stem_ISO_8859_1_hungarian/stem_ISO_8859_2_hungarian/g' sphinx-2.2.7-release/libstemmer_c/Makefile.in
cp -R re2/* sphinx-2.2.7-release/libre2/
cd sphinx-2.2.7-release
./configure --with-libstemmer --with-re2 --prefix=/usr/local/sphinx
make
make install

7
indexer/manual-act.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
PATH_BIN=/usr/bin
PATH_LOG=/var/lib/sphinx/log
echo "$(date '+%Y-%m-%d %H:%M:%S') === INDEXATION ACT" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --rotate act >> $PATH_LOG/indexer.log
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION ACT" >> $PATH_LOG/indexer.log

7
indexer/manual-histo.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
PATH_BIN=/usr/bin
PATH_LOG=/var/lib/sphinx/log
echo "$(date '+%Y-%m-%d %H:%M:%S') === INDEXATION HISTO" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --rotate histo >> $PATH_LOG/indexer.log
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION HISTO" >> $PATH_LOG/indexer.log

View File

@ -1,40 +0,0 @@
#!/bin/bash
PATH_BIN=/usr/local/sphinx/bin
PATH_LOG=/dbs/log
PATH_SQL=/home/scripts/indexer/sql
MYSQL_HOST=192.168.3.30
MYSQL_USER=sphinx
MYSQL_PASS=indexer
# Is consolidated ?
output=$(mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS sdv1 < $PATH_SQL/consolidate-ciblage.sql)
idx='';
for line in "$output"; do
idx="$line";
done
# Suppression fin de ligne
idx=$(echo $idx|sed -e "s/^[idx ]*//g"||sed -e "s/[ ]*$//g")
# Lancement de l'indexation si la consolidation a eu lieu
if [ -n "$idx" ]; then
if [[ "$idx" > 0 ]]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') === INDEXATION CIBLAGE" >> $PATH_LOG/indexer.log
# Enregistrement Debut Indexation
mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS sdv1 -e "UPDATE sphinx_idx SET indexingBegin=NOW() WHERE id=$idx" >> $PATH_LOG/indexer.log
# Sphinx rotate
echo "$(date '+%Y-%m-%d %H:%M:%S') - Sphinx - Debut" >> $PATH_LOG/indexer.log
$PATH_BIN/indexer --config /etc/sphinxsearch/sphinx.conf --rotate ciblage >> $PATH_LOG/indexer.log
echo "$(date '+%Y-%m-%d %H:%M:%S') - Sphinx - Fin" >> $PATH_LOG/indexer.log
# Enregistrement Fin Indexation
mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS sdv1 -e "UPDATE sphinx_idx SET indexingEnd=NOW() WHERE id=$idx" >> $PATH_LOG/indexer.log
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION CIBLAGE" >> $PATH_LOG/indexer.log
fi
fi