Correction

This commit is contained in:
Michael RICOIS 2015-11-06 08:21:44 +00:00
parent 72fc6522ba
commit fb3596f696
7 changed files with 28 additions and 26 deletions

4
README
View File

@ -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

View File

@ -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 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)
@ -47,7 +47,9 @@ 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
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
$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
# 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

View File

@ -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,9 +47,10 @@ 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
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
@ -71,10 +72,7 @@ if [ -n "$idx" ]; then
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
fi
fi
fi

View File

@ -1 +1 @@
SELECT count(*) AS etab from etablissements;
SELECT count(*) AS nb from etablissements;

View File

@ -1 +1 @@
SELECT count(*) AS etab_tmp from etablissements_tmp;
SELECT count(*) AS nb from etablissements_tmp;