I try to run a rpc node, after download headers, it show some warn. It didn't start download block. Anyone can help me?
Mar 27 00:06:43.791 INFO neard: Version: 1.25.0, Build: crates-0.12.0-31-g9b3d6ba55, Latest Protocol: 52
Mar 27 00:06:43.796 INFO near: Opening store database at "/home/aurora/.near/mainnet/data"
Mar 27 00:06:44.033 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=0 total_msg_received_count=0 max_max_record_num_messages_in_progress=0
Mar 27 00:06:54.078 INFO stats: #62165908 Waiting for peers 1 peer ⬇ 0.1kiB/s ⬆ 3 B/s 0.00 bps 0 gas/s
Mar 27 00:07:04.080 INFO stats: #62165908 Waiting for peers 2 peers ⬇ 507.6kiB/s ⬆ 62.4kiB/s 0.00 bps 0 gas/s CPU: 30%, Mem: 145.0 MiB
Mar 27 00:07:14.082 INFO stats: #62165908 Waiting for peers 2 peers ⬇ 1015.8kiB/s ⬆ 616.2kiB/s 0.00 bps 0 gas/s CPU: 156%, Mem: 206.6 MiB
Mar 27 00:07:24.085 INFO stats: #62165908 Downloading headers 100.00% (468) 4 peers ⬇ 1018.6kiB/s ⬆ 2.0MiB/s 0.00 bps 0 gas/s CPU: 14%, Mem: 314.0 MiB
Mar 27 00:07:34.088 INFO stats: #62165908 Downloading headers 100.00% (473) 5 peers ⬇ 1.5MiB/s ⬆ 2.0MiB/s 0.00 bps 0 gas/s CPU: 38%, Mem: 366.0 MiB
Mar 27 00:07:44.091 INFO stats: #62165908 Downloading headers 100.00% (484) 5 peers ⬇ 2.0MiB/s ⬆ 2.5MiB/s 0.00 bps 0 gas/s CPU: 7%, Mem: 378.2 MiB
Mar 27 00:07:44.362 WARN near_network::peer_manager::peer_manager_actor: Peer bandwidth exceeded threshold peer_id=ed25519:DCiEjHES1eRwj8zYbU5EdFyWQRa8zrjq7hhrBmb3Seop bandwidth_used=31287035 msg_received_count=124
Mar 27 00:07:44.362 WARN near_network::peer_manager::peer_manager_actor: Peer bandwidth exceeded threshold peer_id=ed25519:5DNVteGRxgUv4WSpJu4337aQud5P9m8TN1uAwAGzTjFP bandwidth_used=31235365 msg_received_count=123
Mar 27 00:07:44.362 WARN near_network::peer_manager::peer_manager_actor: Peer bandwidth exceeded threshold peer_id=ed25519:EVqGxpKoP3rxqMruuTmkQrhZnVE3um8XF2gwap4HhVqd bandwidth_used=31395111 msg_received_count=248
Mar 27 00:07:44.362 WARN near_network::peer_manager::peer_manager_actor: Peer bandwidth exceeded threshold peer_id=ed25519:CzYbBGrPx3XrdJeoNHs1YAz7TY3garm1RhZqruJXGPY5 bandwidth_used=34275095 msg_received_count=383
Mar 27 00:07:44.362 WARN near_network::peer_manager::peer_manager_actor: Peer bandwidth exceeded threshold peer_id=ed25519:GVWThRijD1ZyqTf6pNvS4BBYBd9gCB2P1Qjfi9DAMi7G bandwidth_used=10089910 msg_received_count=2
Mar 27 00:07:44.362 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=138282516 total_msg_received_count=880 max_max_record_num_messages_in_progress=52
Mar 27 00:08:44.364 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=16194710 total_msg_received_count=1826 max_max_record_num_messages_in_progress=53
Mar 27 00:09:44.365 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=6119474 total_msg_received_count=1653 max_max_record_num_messages_in_progress=85
Mar 27 00:10:44.367 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=10920258 total_msg_received_count=1615 max_max_record_num_messages_in_progress=110
Mar 27 00:11:44.368 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=4072216 total_msg_received_count=1857 max_max_record_num_messages_in_progress=169
Mar 27 00:12:44.369 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=1962496 total_msg_received_count=1741 max_max_record_num_messages_in_progress=249
Mar 27 00:13:44.370 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=2022483 total_msg_received_count=1689 max_max_record_num_messages_in_progress=290
Mar 27 00:14:44.373 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=1901363 total_msg_received_count=1710 max_max_record_num_messages_in_progress=332
Mar 27 00:15:44.374 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=1901830 total_msg_received_count=1635 max_max_record_num_messages_in_progress=372
Mar 27 00:16:44.376 INFO near_network::peer_manager::peer_manager_actor: Bandwidth stats total_bandwidth_used_by_all_peers=1944505 total_msg_received_count=1753 max_max_record_num_messages_in_progress=414```
I'm using Ansible to login to multiple network devices (routers, switches, etc), and obtain the output of various "show" commands from each one. Then all of that output is copied into a single file so I can easily scan it with my eyeballs for anything that might stand out to me.
I have this working (sort of). The problem is that only the output from the first two devices is logged into the file. Anything after that is not copied. My "debug" output from the Playbook does show output from all devices...but not everything is copied into my file.
Any ideas on why this is happening? Theoretically if I wanted Ansible to collect output from 500 devices I'd like all of that output crammed into this single file. Why is it working for only the first two devices it reaches out to?
FYI...you'll see a few lines that are commented out in my Playbook. Whether commented or not, these lines don't fix my problem.
Thanks for any suggestions you can provide!!
---
-
name: Network Device Configuration History Collection
hosts: all
gather_facts: no
tasks:
- name: Sending a simple Cisco IOS command
cisco.ios.ios_command:
commands:
- show configuration history
register: Bob
- debug: var=Bob.stdout_lines
- name: Log Results To File
blockinfile:
# marker: "{{inventory_hostname}}"
content: "{{Bob.stdout_lines}}"
dest: "/etc/ansible/YAML_Files/Config-Change-Logs/data.log"
# with_items:
# - "{{Bob.stdout_lines}}"
Playbook output:
user#user-virtual-machine:/etc/ansible/YAML_Files$ ansible-playbook 11-test-copy.yaml
PLAY [Network Device Configuration History Collection] *****************************************************************
TASK [Sending a simple Cisco IOS command] ******************************************************************************
ok: [r1]
ok: [SW-2]
ok: [r3]
ok: [r2]
ok: [CSR-1]
TASK [debug] ***********************************************************************************************************
ok: [SW-2] => {
"Bob.stdout_lines": [
[
"1 20:43:32 UTC Wed Nov 18 2020User : admin",
"2 20:48:53 UTC Wed Nov 18 2020User : admin",
"3 17:02:04 UTC Tue Dec 1 2020",
"4 17:04:21 UTC Tue Dec 1 2020User : admin",
"5 17:05:01 UTC Tue Dec 1 2020User : admin"
]
]
}
ok: [r1] => {
"Bob.stdout_lines": [
[
"1 20:48:45 UTC Wed Nov 18 2020User : test",
"2 19:47:05 UTC Thu Nov 19 2020",
"3 19:58:45 UTC Thu Nov 19 2020User : test",
"4 19:57:31 UTC Mon Nov 23 2020",
"5 19:50:43 UTC Tue Dec 1 2020"
]
]
}
ok: [r2] => {
"Bob.stdout_lines": [
[
"1 15:21:53 UTC Tue Dec 1 2020User : admin",
"2 15:24:30 UTC Tue Dec 1 2020User : admin",
"3 15:26:35 UTC Tue Dec 1 2020User : admin",
"4 15:37:06 UTC Tue Dec 1 2020User : admin",
"5 15:39:48 UTC Tue Dec 1 2020User : admin"
]
]
}
ok: [r3] => {
"Bob.stdout_lines": [
[
"1 17:01:26 UTC Tue Dec 1 2020User : admin",
"2 17:01:26 UTC Tue Dec 1 2020User : admin",
"3 17:01:26 UTC Tue Dec 1 2020User : admin",
"4 17:01:27 UTC Tue Dec 1 2020User : admin",
"5 17:01:27 UTC Tue Dec 1 2020User : admin"
]
]
}
ok: [CSR-1] => {
"Bob.stdout_lines": [
[
"1 19:43:41 UTC Mon Nov 23 2020",
"2 19:45:13 UTC Mon Nov 23 2020",
"3 19:47:26 UTC Mon Nov 23 2020",
"4 19:47:54 UTC Mon Nov 23 2020",
"5 19:48:21 UTC Mon Nov 23 2020"
]
]
}
TASK [Log Results To File] *********************************************************************************************
[WARNING]: The value [['********', '********', '********', '********', '********']] (type list) in a string field was
converted to u"[['********', '********', '********', '********', '********']]" (type string). If this does not look
like what you expect, quote the entire value to ensure it does not change.
changed: [r2]
changed: [CSR-1]
changed: [r1]
changed: [r3]
changed: [SW-2]
PLAY RECAP *************************************************************************************************************
CSR-1 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
SW-2 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
r1 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
r2 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
r3 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
user#user-virtual-machine:/etc/ansible/YAML_Files$
Resulting File:
r1
1 20:48:45 UTC Wed Nov 18 2020User : test
2 19:47:05 UTC Thu Nov 19 2020
3 19:58:45 UTC Thu Nov 19 2020User : test
4 19:57:31 UTC Mon Nov 23 2020
5 19:50:43 UTC Tue Dec 1 2020
r1
SW-2
1 20:43:32 UTC Wed Nov 18 2020User : admin
2 20:48:53 UTC Wed Nov 18 2020User : admin
3 17:02:04 UTC Tue Dec 1 2020
4 17:04:21 UTC Tue Dec 1 2020User : admin
5 17:05:01 UTC Tue Dec 1 2020User : admin
SW-2
# BEGIN ANSIBLE MANAGED BLOCK
[['1 20:43:32 UTC Wed Nov 18 2020User : admin', '2 20:48:53 UTC Wed Nov 18 2020User : admin', '3 17:02:04 UTC Tue Dec 1 2020', '4 17:04:21 UTC Tue Dec 1 2020User : admin', '5 17:05:01 UTC Tue Dec 1 2020User : admin']]
# END ANSIBLE MANAGED BLOCK
With this simple function, I can get the week number. Now, with the number of the week, how can I get the date range, started on Sunday?
import (
"fmt"
"time"
)
func main() {
Week(time.Now().UTC())
}
func Week(now time.Time) string {
_, thisWeek := now.ISOWeek()
return "S" + strconv.Itoa(thisWeek)
}
Foreword: Time.ISOWeek() returns you the week number that starts on Monday, so I will answer your question that also handles weeks starting on Monday. Alter it to your needs if you want it to work with weeks starting on Sunday.
I released this utility in github.com/icza/gox, see timex.WeekStart().
The standard library does not provide a function that would return you the date range of a given week (year+week number). So we have to construct one ourselves.
And it's not that hard. We can start off from the middle of the year, align to the first day of the week (Monday), get the week of this time value, and corrigate: add as many days as the week difference multiplied by 7.
This is how it could look like:
func WeekStart(year, week int) time.Time {
// Start from the middle of the year:
t := time.Date(year, 7, 1, 0, 0, 0, 0, time.UTC)
// Roll back to Monday:
if wd := t.Weekday(); wd == time.Sunday {
t = t.AddDate(0, 0, -6)
} else {
t = t.AddDate(0, 0, -int(wd)+1)
}
// Difference in weeks:
_, w := t.ISOWeek()
t = t.AddDate(0, 0, (week-w)*7)
return t
}
Testing it:
fmt.Println(WeekStart(2018, 1))
fmt.Println(WeekStart(2018, 2))
fmt.Println(WeekStart(2019, 1))
fmt.Println(WeekStart(2019, 2))
Output (try it on the Go Playground):
2018-01-01 00:00:00 +0000 UTC
2018-01-08 00:00:00 +0000 UTC
2018-12-31 00:00:00 +0000 UTC
2019-01-07 00:00:00 +0000 UTC
One nice property of this WeekStart() implementation is that it handles out-of-range weeks nicely. That is, if you pass 0 for the week, it will be interpreted as the last week of the previous year. If you pass -1 for the week, it will designate the second to last week of the previous year. Similarly, if you pass max week of the year plus 1, it will be interpreted as the first week of the next year etc.
The above WeekStart() function only returns the given week's first day (Monday), because the last day of the week is always its first day + 6 days.
If we also need the last day:
func WeekRange(year, week int) (start, end time.Time) {
start = WeekStart(year, week)
end = start.AddDate(0, 0, 6)
return
}
Testing it:
fmt.Println(WeekRange(2018, 1))
fmt.Println(WeekRange(2018, 2))
fmt.Println(WeekRange(2019, 1))
fmt.Println(WeekRange(2019, 2))
Output (try it on the Go Playground):
2018-01-01 00:00:00 +0000 UTC 2018-01-07 00:00:00 +0000 UTC
2018-01-08 00:00:00 +0000 UTC 2018-01-14 00:00:00 +0000 UTC
2018-12-31 00:00:00 +0000 UTC 2019-01-06 00:00:00 +0000 UTC
2019-01-07 00:00:00 +0000 UTC 2019-01-13 00:00:00 +0000 UTC
The following does the work of finding the first day of week for me, although not from week number but from time. If you add an extra parameter - for the hard-coded time.Monday - that can be any day of week, e.g. Sunday.
func weekStartDate(date time.Time) time.Time {
offset := (int(time.Monday) - int(date.Weekday()) - 7) % 7
result := date.Add(time.Duration(offset*24) * time.Hour)
return result
}
Test:
func TestWeekStartDate(t *testing.T) {
date := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)
for i := 0; i < 2000; i++ {
weekStart := weekStartDate(date)
log.Printf("%s %s", date.Format("2006-01-02 Mon"), weekStart.Format("2006-01-02 Mon"))
assert.NotNil(t, weekStart)
assert.Equal(t, time.Monday, weekStart.Weekday())
date = date.Add(24 * time.Hour)
}
}
Output:
...
2021/01/17 08:50:03 2020-12-15 Tue 2020-12-14 Mon
2021/01/17 08:50:03 2020-12-16 Wed 2020-12-14 Mon
2021/01/17 08:50:03 2020-12-17 Thu 2020-12-14 Mon
2021/01/17 08:50:03 2020-12-18 Fri 2020-12-14 Mon
2021/01/17 08:50:03 2020-12-19 Sat 2020-12-14 Mon
2021/01/17 08:50:03 2020-12-20 Sun 2020-12-14 Mon
2021/01/17 08:50:03 2020-12-21 Mon 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-22 Tue 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-23 Wed 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-24 Thu 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-25 Fri 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-26 Sat 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-27 Sun 2020-12-21 Mon
2021/01/17 08:50:03 2020-12-28 Mon 2020-12-28 Mon
2021/01/17 08:50:03 2020-12-29 Tue 2020-12-28 Mon
2021/01/17 08:50:03 2020-12-30 Wed 2020-12-28 Mon
2021/01/17 08:50:03 2020-12-31 Thu 2020-12-28 Mon
2021/01/17 08:50:03 2021-01-01 Fri 2020-12-28 Mon
2021/01/17 08:50:03 2021-01-02 Sat 2020-12-28 Mon
2021/01/17 08:50:03 2021-01-03 Sun 2020-12-28 Mon
2021/01/17 08:50:03 2021-01-04 Mon 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-05 Tue 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-06 Wed 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-07 Thu 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-08 Fri 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-09 Sat 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-10 Sun 2021-01-04 Mon
2021/01/17 08:50:03 2021-01-11 Mon 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-12 Tue 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-13 Wed 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-14 Thu 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-15 Fri 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-16 Sat 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-17 Sun 2021-01-11 Mon
2021/01/17 08:50:03 2021-01-18 Mon 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-19 Tue 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-20 Wed 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-21 Thu 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-22 Fri 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-23 Sat 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-24 Sun 2021-01-18 Mon
2021/01/17 08:50:03 2021-01-25 Mon 2021-01-25 Mon
2021/01/17 08:50:03 2021-01-26 Tue 2021-01-25 Mon
2021/01/17 08:50:03 2021-01-27 Wed 2021-01-25 Mon
2021/01/17 08:50:03 2021-01-28 Thu 2021-01-25 Mon
2021/01/17 08:50:03 2021-01-29 Fri 2021-01-25 Mon
2021/01/17 08:50:03 2021-01-30 Sat 2021-01-25 Mon
2021/01/17 08:50:03 2021-01-31 Sun 2021-01-25 Mon
2021/01/17 08:50:03 2021-02-01 Mon 2021-02-01 Mon
2021/01/17 08:50:03 2021-02-02 Tue 2021-02-01 Mon
2021/01/17 08:50:03 2021-02-03 Wed 2021-02-01 Mon
2021/01/17 08:50:03 2021-02-04 Thu 2021-02-01 Mon
2021/01/17 08:50:03 2021-02-05 Fri 2021-02-01 Mon
...
Thanks to #prajwal Singh, I've found more generic to find out the start and last day of the week w.r.t month, week, and year
func DateRange(week, month, year int) (startDate, endDate time.Time) {
timeBenchmark := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC)
weekStartBenchmark := timeBenchmark.AddDate(0, 0, -(int(timeBenchmark.Weekday())+6)%7)
startDate = weekStartBenchmark.AddDate(0, 0, (week-1)*7)
endDate = startDate.AddDate(0, 0, 6)
return startDate, endDate
}
Thanks to #icza for the solution, found a way to simplify it even further in terms of logic:
func DateRange(week, year int) (startDate, endDate time.Time) {
timeBenchmark := time.Date(year, 7, 1, 0, 0, 0, 0, time.UTC)
weekStartBenchmark := timeBenchmark.AddDate(0, 0, -(int(timeBenchmark.Weekday())+6)%7)
_, weekBenchmark := weekStartBenchmark.ISOWeek()
startDate = weekStartBenchmark.AddDate(0, 0, (week-weekBenchmark)*7)
endDate = startDate.AddDate(0, 0, 6)
return startDate, endDate
}
Works fine as well.
I want to automate a task quarterly in a year.
Task should execute
Jan 1st
April 1st
July 1st
October 1st
etc
As I tried #Scheduled(cron = "0 0 6 1 1/3 ?") in Spring Boot application but its not working currently and mail didn't trigger quarterly.
Try this
#scheduled(cron = "0 0 6 1 */3 *")
So read the first day of each 3 month at 6:00
Try this one -
#scheduled(cron ="0 0 0 1 JAN,APR,JUL,OCT ? *")
Next execution:
Wed Jul 01 00:00:00 UTC 2020
Thu Oct 01 00:00:00 UTC 2020
Fri Jan 01 00:00:00 UTC 2021
Thu Apr 01 00:00:00 UTC 2021
Thu Jul 01 00:00:00 UTC 2021
Fri Oct 01 00:00:00 UTC 2021
Sat Jan 01 00:00:00 UTC 2022
Fri Apr 01 00:00:00 UTC 2022
Fri Jul 01 00:00:00 UTC 2022
Sat Oct 01 00:00:00 UTC 2022
I have updates my Elasticsearch config file (Note:ES is 2.2) for making it CORS enabled.I had done the same for ES 1.4 and it worked fine but here its not working and ES does not restart .Below is the error and config file
Error :
root#XXX:/etc/elasticsearch# sudo service elasticsearch status -l
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2016-03-11 00:03:03 EST; 9min ago
Docs: http://www.elastic.co
Process: 9710 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.pidfile=${PID_DIR}/elasticsearch.pid -Des.default.path.home=${ES_HOME} -Des.default.path.logs=${LOG_DIR} -Des.default.path.data=${DATA_DIR} -Des.default.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 9707 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 9710 (code=exited, status=1/FAILURE)
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: network.host: XX.XX.XX.XX
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: ^
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: expected <block end>, but found BlockMappingStart
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: in 'reader', line 67, column 3:
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: http.cors.enabled: true
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: ^
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl$ParseBlockM...a:570)
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 systemd[1]: elasticsearch.service: Unit entered failed state.
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
My ES Config File is as below (Updated YML After Below suggestions)
# network.bind_host: 127.0.0.1
http.publish_port: 9200
http.port: 9200
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
http.cors.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
Every line must be indented exactly one space from the left. The line http.cors.enabled: true seems to be indented two spaces.