Skip to content

Commit

Permalink
LRQA-56124 Update arg usage for elasticsearch7
Browse files Browse the repository at this point in the history
  • Loading branch information
brookedalton authored and brianchandotcom committed Mar 11, 2020
1 parent 4a4d6d0 commit 1168aa6
Showing 1 changed file with 131 additions and 9 deletions.
140 changes: 131 additions & 9 deletions build-test-elasticsearch7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,11 @@ ${line.separator}CATALINA_OPTS="${CATALINA_OPTS} -Djavax.net.ssl.trustStore=${el
<macrodef name="start-ccr-trial">
<sequential>
<exec executable="curl" outputproperty="curl.output.trial.remote.cluster">
<arg line="-X POST &quot;http://localhost:9200/_license/start_trial?acknowledge=true&quot; -H &apos;Content-Type:application/json&apos;" />
<arg value="-X" />
<arg value="POST" />
<arg value="http://localhost:9200/_license/start_trial?acknowledge=true" />
<arg value="-H" />
<arg value="Content-Type:application/json" />
</exec>

<echo>${curl.output.trial.remote.cluster}</echo>
Expand All @@ -525,7 +529,11 @@ ${line.separator}CATALINA_OPTS="${CATALINA_OPTS} -Djavax.net.ssl.trustStore=${el
</if>

<exec executable="curl" outputproperty="curl.output.trial.local.cluster">
<arg line="-X POST &quot;http://localhost:9202/_license/start_trial?acknowledge=true&quot; -H &apos;Content-Type:application/json&apos;" />
<arg value="-X" />
<arg value="POST" />
<arg value="http://localhost:9202/_license/start_trial?acknowledge=true" />
<arg value="-H" />
<arg value="Content-Type:application/json" />
</exec>

<echo>${curl.output.trial.local.cluster}</echo>
Expand Down Expand Up @@ -842,26 +850,82 @@ xpack.monitoring.collection.enabled: true</echo>
select="\1"
/>

<property name="configure.cluster">
<![CDATA[
{
"persistent": {
"cluster": {
"remote": {
"leader": {
"seeds": [
"127.0.0.1:9300"
]
}
}
}
}
}
]]>
</property>

<exec executable="curl" outputproperty="curl.output.connect.to.remote.cluster">
<arg line="-X PUT &quot;localhost:9202/_cluster/settings&quot; -H &apos;Content-Type: application/json&apos; -d &apos;{&quot;persistent&quot;:{&quot;cluster&quot;:{&quot;remote&quot;:{&quot;leader&quot;:{&quot;seeds&quot;:[&quot;127.0.0.1:9300&quot;]}}}}}&apos;" />
<arg value="-X" />
<arg value="PUT" />
<arg value="localhost:9202/_cluster/settings" />
<arg value="-H" />
<arg value="Content-Type: application/json" />
<arg value="-d" />
<arg value="${configure.cluster}" />
</exec>

<echo>${curl.output.connect.to.remote.cluster}</echo>

<property name="follower.liferay.index">
<![CDATA[
{
"remote_cluster": "leader",
"leader_index": "liferay-${companyId}"
}
]]>
</property>

<exec executable="curl" outputproperty="curl.output.follower.liferay.index">
<arg line="-X PUT &quot;localhost:9202/liferay-${companyId}/_ccr/follow?wait_for_active_shards=1&quot; -H &apos;Content-Type: application/json&apos; -d &apos;{&quot;remote_cluster&quot;: &quot;leader&quot;,&quot;leader_index&quot;: &quot;liferay-${companyId}&quot;}&apos;" />
<arg value="-X" />
<arg value="PUT" />
<arg value="localhost:9202/liferay-${companyId}/_ccr/follow?wait_for_active_shards=1" />
<arg value="-H" />
<arg value="Content-Type: application/json" />
<arg value="-d" />
<arg value="${follower.liferay.index}" />
</exec>

<echo>${curl.output.follower.liferay.index}</echo>

<property name="follower.synonyms.index">
<![CDATA[
{
"remote_cluster": "leader",
"leader_index": "liferay-search-tuning-synonyms-liferay-${companyId}"
}
]]>
</property>

<exec executable="curl" outputproperty="curl.output.follower.synonyms.index">
<arg line="-X PUT &quot;localhost:9202/liferay-search-tuning-synonyms-liferay-${companyId}/_ccr/follow?wait_for_active_shards=1&quot; -H &apos;Content-Type: application/json&apos; -d &apos;{&quot;remote_cluster&quot;: &quot;leader&quot;,&quot;leader_index&quot;: &quot;liferay-search-tuning-synonyms-liferay-${companyId}&quot;}&apos;" />
<arg value="-X" />
<arg value="PUT" />
<arg value="localhost:9202/liferay-search-tuning-synonyms-liferay-${companyId}/_ccr/follow?wait_for_active_shards=1" />
<arg value="-H" />
<arg value="Content-Type: application/json" />
<arg value="-d" />
<arg value="${follower.synonyms.index}" />
</exec>

<echo>${curl.output.follower.synonyms.index}</echo>

<exec executable="curl" outputproperty="curl.output.follower.indices">
<arg line="-X GET &quot;localhost:9202/_cat/indices&quot;" />
<arg value="-X" />
<arg value="GET" />
<arg value="localhost:9202/_cat/indices" />
</exec>

<echo>${curl.output.follower.indices}</echo>
Expand Down Expand Up @@ -921,8 +985,31 @@ xpack.monitoring.collection.enabled: true</echo>
<equals arg1="${remote.elasticsearch.enabled}" arg2="true" />
</condition>

<property name="elasticsearch.print.query">
<![CDATA[
{
"query": {
"bool": {
"must": [
{ "match": { "userName": "test test" } }
],
"must_not": [
{ "match": { "hidden": "true" } },
{ "match": { "entryClassName": "com.liferay.portal.kernel.model.Layout" } },
{ "match": { "entryClassName": "com.liferay.calendar.model.Calendar" } }
]
}
}
}
]]>
</property>

<exec executable="curl" outputproperty="curl.output.elasticsearch.indices">
<arg line="&apos;localhost:${elasticsearch.port}/liferay-${companyId}/_search?pretty&apos; -H &apos;Content-Type: application/json&apos; -d&apos;{&quot;query&quot;: {&quot;bool&quot;: {&quot;must&quot;: [{ &quot;match&quot;: { &quot;userName&quot;: &quot;test test&quot; } }],&quot;must_not&quot;: [{ &quot;match&quot;: { &quot;hidden&quot;: &quot;true&quot; } }, { &quot;match&quot;: { &quot;entryClassName&quot;: &quot;com.liferay.portal.kernel.model.Layout&quot; } }, { &quot;match&quot;: { &quot;entryClassName&quot;: &quot;com.liferay.calendar.model.Calendar&quot; } }]}}}&apos;" />
<arg value="localhost:${elasticsearch.port}/liferay-${companyId}/_search?pretty" />
<arg value="-H" />
<arg value="Content-Type: application/json" />
<arg value="-d" />
<arg value="${elasticsearch.print.query}" />
</exec>

<echo></echo>
Expand All @@ -935,14 +1022,49 @@ xpack.monitoring.collection.enabled: true</echo>
</target>

<target name="restore-backup">
<property name="register.repository">
<![CDATA[
{
"type": "fs",
"settings": {
"location": "${liferay.home}/data/elasticsearch7/repo"
}
}
]]>
</property>

<exec executable="curl" outputproperty="curl.output">
<arg line="-X PUT &quot;localhost:${elasticsearch.port}/_snapshot/my_backup&quot; -H &apos;Content-Type: application/json&apos; -d&apos;{&quot;type&quot;: &quot;fs&quot;,&quot;settings&quot;: {&quot;location&quot;: &quot;${liferay.home}/data/elasticsearch7/repo&quot;}}&apos;" />
<arg value="-X" />
<arg value="PUT" />
<arg value="localhost:${elasticsearch.port}/_snapshot/my_backup" />
<arg value="-H" />
<arg value="Content-Type: application/json" />
<arg value="-d" />
<arg value="${register.repository}" />
</exec>

<echo>Defining snapshot repository.${line.separator}${curl.output}</echo>

<property name="restore.repository">
<![CDATA[
{
"indices": "${backup.index}",
"ignore_unavailable": true,
"include_global_state": true,
"rename_pattern": "index_(.+)",
"rename_replacement": "restored_index_$1"
}
]]>
</property>

<exec executable="curl" outputproperty="curl.output">
<arg line="-X POST &quot;localhost:${elasticsearch.port}/_snapshot/my_backup/snapshot_2/_restore&quot; -H &apos;Content-Type: application/json&apos; -d&apos;{&quot;indices&quot;: &quot;${backup.index}&quot;,&quot;ignore_unavailable&quot;: true,&quot;include_global_state&quot;: true,&quot;rename_pattern&quot;: &quot;index_(.+)&quot;,&quot;rename_replacement&quot;: &quot;restored_index_$1&quot;}&apos;" />
<arg value="-X" />
<arg value="POST" />
<arg value="localhost:${elasticsearch.port}/_snapshot/my_backup/snapshot_2/_restore" />
<arg value="-H" />
<arg value="Content-Type: application/json" />
<arg value="-d" />
<arg value="${restore.repository}" />
</exec>

<echo>Restoring snapshot.${line.separator}${curl.output}</echo>
Expand Down

0 comments on commit 1168aa6

Please sign in to comment.