Correction
This commit is contained in:
parent
72fc6522ba
commit
fb3596f696
4
README
4
README
@ -24,6 +24,10 @@ Sphinx Engine configuration
|
||||
sed -i -e 's/ENV_MYSQLHOST/VALUE/g' indexer/*.sh
|
||||
sed -i -e 's/ENV_MYSQLUSER/VALUE/g' indexer/*.sh
|
||||
sed -i -e 's/ENV_MYSQLPASS/VALUE/g' indexer/*.sh
|
||||
|
||||
- Crontab
|
||||
- Logrotate
|
||||
|
||||
Indexing
|
||||
--------
|
||||
indexer-*.sh : Index on master database with rotation
|
||||
|
2
env.sh
2
env.sh
@ -9,4 +9,4 @@ sed -i -e s/ENV_MYSQLUSER/"$ENV_MYSQLUSER"/g sphinx.*.conf
|
||||
sed -i -e s/ENV_MYSQLPASS/"$ENV_MYSQLPASS"/g sphinx.*.conf
|
||||
sed -i -e s/ENV_MYSQLHOST/"$ENV_MYSQLHOST"/g indexer/*.sh
|
||||
sed -i -e s/ENV_MYSQLUSER/"$ENV_MYSQLUSER"/g indexer/*.sh
|
||||
sed -i -e s/ENV_MYSQLPASS/"$ENV_MYSQLPASS"/g indexer/*.sh
|
||||
sed -i -e s/ENV_MYSQLPASS/"$ENV_MYSQLPASS"/g indexer/*.sh
|
||||
|
@ -24,9 +24,9 @@ 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 DIR" >> $PATH_LOG/indexer.log
|
||||
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === INDEXATION DIR" >> $PATH_LOG/indexer.log
|
||||
|
||||
# Nombre de lignes dans la table etablissements
|
||||
output=$(mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS jo < $PATH_SQL/count-dir.sql)
|
||||
nbC='';
|
||||
@ -45,9 +45,11 @@ if [ -n "$idx" ]; then
|
||||
done
|
||||
# Suppression fin de ligne
|
||||
nbT=$(echo $nbT|sed -e "s/^[nbT ]*//g"||sed -e "s/[ ]*$//g")
|
||||
|
||||
|
||||
if [ -z "$nbC" ]; then
|
||||
echo $nbC
|
||||
elif [ -z "$nbT" ]; then
|
||||
echo $nbT
|
||||
elif [ "$nbT" -gt "$nbC" ]; then
|
||||
|
||||
# Create file to indicate indexing
|
||||
@ -59,21 +61,19 @@ if [ -n "$idx" ]; then
|
||||
|
||||
# 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 dir dir_phx >> $PATH_LOG/indexer.log
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Sphinx - Fin" >> $PATH_LOG/indexer.log
|
||||
|
||||
# Rotation des tables MySQL
|
||||
$PATH_BIN/indexer --config /etc/sphinxsearch/sphinx.conf --rotate dir dir_phx >> $PATH_LOG/indexer.log
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Sphinx - Fin" >> $PATH_LOG/indexer.log
|
||||
|
||||
# Rotation des tables MySQL
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Rotation Table - Debut" >> $PATH_LOG/indexer.log
|
||||
mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS jo < $PATH_SQL/rotate-dir.sql >> $PATH_LOG/indexer.log
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Rotation Table - Fin" >> $PATH_LOG/indexer.log
|
||||
mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS jo < $PATH_SQL/rotate-dir.sql >> $PATH_LOG/indexer.log
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Rotation Table - 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 "FIN $(date '+%Y-%m-%d %H:%M:%S')" >> $FILEINDEX
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION DIR" >> $PATH_LOG/indexer.log
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
@ -25,7 +25,7 @@ idx=$(echo $idx|sed -e "s/^[idx ]*//g"||sed -e "s/[ ]*$//g")
|
||||
if [ -n "$idx" ]; then
|
||||
if [[ "$idx" > 0 ]]; then
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === INDEXATION ENT" >> $PATH_LOG/indexer.log
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === INDEXATION ENT" >> $PATH_LOG/indexer.log
|
||||
|
||||
# Nombre de lignes dans la table etablissements
|
||||
output=$(mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS jo < $PATH_SQL/count-ent.sql)
|
||||
@ -47,21 +47,22 @@ if [ -n "$idx" ]; then
|
||||
nbT=$(echo $nbT|sed -e "s/^[nbT ]*//g"||sed -e "s/[ ]*$//g")
|
||||
|
||||
if [ -z "$nbC" ]; then
|
||||
echo $nbC
|
||||
elif [ -z "$nbT" ]; then
|
||||
elif [ "$nbT" -gt "$nbC" ]; then
|
||||
|
||||
echo $nbT
|
||||
elif [ "$nbT" -gt "$nbC" ]; then
|
||||
# Create file to indicate indexing
|
||||
rm -f $PATH_LOG/ent-*.idx
|
||||
echo "START $(date '+%Y-%m-%d %H:%M:%S')" >> $FILEINDEX
|
||||
|
||||
# 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 ent ent_phx >> $PATH_LOG/indexer.log
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Sphinx - Fin" >> $PATH_LOG/indexer.log
|
||||
|
||||
|
||||
# Rotation des tables MySQL
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Rotation Table - Debut" >> $PATH_LOG/indexer.log
|
||||
mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS jo < $PATH_SQL/rotate-ent.sql >> $PATH_LOG/indexer.log
|
||||
@ -69,12 +70,9 @@ if [ -n "$idx" ]; then
|
||||
|
||||
# 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 "FIN $(date '+%Y-%m-%d %H:%M:%S')" >> $FILEINDEX
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION ENT" >> $PATH_LOG/indexer.log
|
||||
|
||||
echo "FIN $(date '+%Y-%m-%d %H:%M:%S')" >> $FILEINDEX
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === FIN INDEXATION ENT" >> $PATH_LOG/indexer.log
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
@ -3,7 +3,7 @@ PATH_LOG=/var/lib/sphinxsearch/log
|
||||
PATH_BIN=/usr/bin
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') === REPRISE INDEXATION ENT" >> $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.reprise.conf --rotate ent ent_phx >> $PATH_LOG/indexer.log
|
||||
|
@ -1 +1 @@
|
||||
SELECT count(*) AS etab from etablissements;
|
||||
SELECT count(*) AS nb from etablissements;
|
||||
|
@ -1 +1 @@
|
||||
SELECT count(*) AS etab_tmp from etablissements_tmp;
|
||||
SELECT count(*) AS nb from etablissements_tmp;
|
||||
|
Loading…
Reference in New Issue
Block a user