Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
deploy_es_synonym
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
deploy_es_synonym
Commits
424efc43
Commit
424efc43
authored
Apr 24, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
91a1d410
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
8 deletions
+38
-8
update_synonyms.sh
update_synonyms.sh
+38
-8
No files found.
update_synonyms.sh
View file @
424efc43
...
@@ -3,8 +3,15 @@
...
@@ -3,8 +3,15 @@
set
-e
set
-e
set
-x
set
-x
SYS
=
$1
ENV
=
$2
if
[
$#
!=
2
]
then
echo
"need tow parameters![gm/alpha prod/dev/test]"
exit
fi
ENV
=
$1
if
[[
"
$ENV
"
==
"dev"
||
"
$ENV
"
==
"test"
]]
;
then
if
[[
"
$ENV
"
==
"dev"
||
"
$ENV
"
==
"test"
]]
;
then
MYSQL_USER
=
"work"
MYSQL_USER
=
"work"
MYSQL_PASSWORD
=
"Gengmei123"
MYSQL_PASSWORD
=
"Gengmei123"
...
@@ -12,11 +19,20 @@ if [[ "$ENV" == "dev" || "$ENV" == "test" ]];then
...
@@ -12,11 +19,20 @@ if [[ "$ENV" == "dev" || "$ENV" == "test" ]];then
MYSQL_DB
=
"alpha"
MYSQL_DB
=
"alpha"
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=47c7de55db1234c6ee0d8f61abae8bc54591f3cef438a41905a0bf4fa33dd6cf'
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=47c7de55db1234c6ee0d8f61abae8bc54591f3cef438a41905a0bf4fa33dd6cf'
else
else
if
[[
"
$SYS
"
==
"alpha"
]]
then
MYSQL_USER
=
"work"
MYSQL_USER
=
"work"
MYSQL_PASSWORD
=
"oars152!traipseize738"
MYSQL_PASSWORD
=
"oars152!traipseize738"
MYSQL_HOST
=
"172.17.40.144"
MYSQL_HOST
=
"172.17.40.144"
MYSQL_DB
=
"alpha"
MYSQL_DB
=
"alpha"
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=53686301db86625c308a837fd6d26f56629fc69e693d21b0b12499ab54e74805'
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=53686301db86625c308a837fd6d26f56629fc69e693d21b0b12499ab54e74805'
else
MYSQL_USER
=
"work"
MYSQL_PASSWORD
=
"BJQaT9VzDcuPBqkd"
MYSQL_HOST
=
"172.16.30.143"
MYSQL_DB
=
"zhengxing"
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=53686301db86625c308a837fd6d26f56629fc69e693d21b0b12499ab54e74805'
fi
fi
fi
...
@@ -64,24 +80,38 @@ echo "getting synonym from db..."
...
@@ -64,24 +80,38 @@ echo "getting synonym from db..."
linestoskip
=
1
linestoskip
=
1
Counter
=
0
Counter
=
0
SQL
=
"SELECT name,alias FROM community_tag where is_deleted=0 and is_online=1 and alias!='' and name!=''"
if
[[
"
$SYS
"
==
"alpha"
]]
mysql
-h
$MYSQL_HOST
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
$MYSQL_DB
-e
"
$SQL
"
|
while
read
name
alias
then
do
SQL
=
"SELECT name,alias FROM community_tag where is_deleted=0 and is_online=1 and alias!='' and name!=''"
mysql
-h
$MYSQL_HOST
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
$MYSQL_DB
-e
"
$SQL
"
|
while
read
name
alias
do
if
[[
$Counter
-ge
$linestoskip
]]
;
then
if
[[
$Counter
-ge
$linestoskip
]]
;
then
echo
"
$name
"",""
$alias
"
>>
$FILE
echo
"
$name
"",""
$alias
"
>>
$FILE
echo
"
$name
"
>>
$DICFILE
echo
"
$name
"
>>
$DICFILE
echo
"
$alias
"
>>
$DICFILE
echo
"
$alias
"
>>
$DICFILE
fi
fi
Counter
=
`
expr
$Counter
+ 1
`
Counter
=
`
expr
$Counter
+ 1
`
done
done
else
SQL
=
"SELECT GROUP_CONCAT(word SEPARATOR ',') FROM api_wordrelsynonym GROUP BY wordrel_id"
mysql
-h
$MYSQL_HOST
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
$MYSQL_DB
-e
"
$SQL
"
|
while
IFS
=
read
-r
ROW
do
if
[[
$Counter
-ge
$linestoskip
]]
;
then
echo
"
$ROW
"
>>
$FILE
array
=(
${
$ROW
//,/
}
)
for
var
in
${
array
[@]
}
do
echo
"
$var
"
>>
$DICFILE
done
fi
Counter
=
`
expr
$Counter
+ 1
`
done
fi
cat
$FILE
>
./synonym.txt
cat
$FILE
>
./synonym.txt
cp
./synonym.txt /srv/apps/elasticsearch/config/analysis/
cp
./synonym.txt /srv/apps/elasticsearch/config/analysis/
cat
$DICFILE
>
./synonym.dic
cat
$DICFILE
>
./synonym.dic
cp
-rf
config /srv/apps/elasticsearch/plugins/analysis-ik/
cp
./synonym.dic /srv/apps/elasticsearch/plugins/analysis-ik/config/ik/custom/
cp
./synonym.dic /srv/apps/elasticsearch/plugins/analysis-ik/config/ik/custom/
# update es
# update es
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment