teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

質問内容を修正しました。

2021/11/18 00:24

投稿

raspypy
raspypy

スコア247

title CHANGED
File without changes
body CHANGED
@@ -1,12 +1,8 @@
1
1
  ##やろうとしていること
2
2
 
3
- **次の記事を参考にして、InfluxDBを作成しました。**
3
+ **次の記事を参考にして、DBを作成しました。**
4
4
  https://www.mikan-tech.net/entry/raspi-sensortag-influxdb
5
5
 
6
- 開発環境は、
7
- ノートPC -(SSH接続)- Raspberry Pi
8
- です。
9
-
10
6
  データベースの作成、Grafanaでの可視化までできていたのですが、
11
7
  Raspberry Piを再起動した後、次のエラーがでてしまい、データベースにアクセスできなくなってしまいました。
12
8
  原因が分からず困っております。
@@ -15,40 +11,6 @@
15
11
  次のメッセージはプログラムを実行したときのエラーです。
16
12
  ```text
17
13
  Traceback (most recent call last):
18
- File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
19
- (self._dns_host, self.port), self.timeout, **extra_kw)
20
- File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 80, in create_connection
21
- raise err
22
- File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 70, in create_connection
23
- sock.connect(sa)
24
- ConnectionRefusedError: [Errno 111] Connection refused
25
-
26
- During handling of the above exception, another exception occurred:
27
-
28
- Traceback (most recent call last):
29
- File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
30
- chunked=chunked)
31
- File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
32
- conn.request(method, url, **httplib_request_kw)
33
- File "/usr/lib/python3.7/http/client.py", line 1260, in request
34
- self._send_request(method, url, body, headers, encode_chunked)
35
- File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
36
- self.endheaders(body, encode_chunked=encode_chunked)
37
- File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
38
- self._send_output(message_body, encode_chunked=encode_chunked)
39
- File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
40
- self.send(msg)
41
- File "/usr/lib/python3.7/http/client.py", line 970, in send
42
- self.connect()
43
- File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in connect
44
- conn = self._new_conn()
45
- File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
46
- self, "Failed to establish a new connection: %s" % e)
47
- urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x72d8b310>: Failed to establish a new connection: [Errno 111] Connection refused
48
-
49
- During handling of the above exception, another exception occurred:
50
-
51
- Traceback (most recent call last):
52
14
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
53
15
  timeout=timeout
54
16
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
@@ -59,49 +21,4 @@
59
21
 
60
22
  During handling of the above exception, another exception occurred:
61
23
 
62
- Traceback (most recent call last):
63
- File "./56_InfluxDB.py", line 45, in <module>
64
- write_to_influxdb(sdata)
65
- File "./56_InfluxDB.py", line 25, in write_to_influxdb
66
- db.write_points(points)
67
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 608, in write_points
68
- consistency=consistency)
69
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 685, in _write_points
70
- protocol=protocol
71
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 419, in write
72
- headers=headers
73
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 342, in request
74
- timeout=self._timeout
75
- File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
76
- resp = self.send(prep, **send_kwargs)
77
- File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
78
- r = adapter.send(request, **kwargs)
79
- File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
80
- raise ConnectionError(e, request=request)
81
- requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8086): Max retries exceeded with url: /write?db=sensor (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x72d8b310>: Failed to establish a new connection: [Errno 111] Connection refused'))
82
- ```
83
-
84
- ##試したこと1
85
- **sudo nano /etc/influxdb/influxdb.conf**
86
- にて、
87
- bind-address = "127.0.0.1:8086"
88
- を追加しましたが、ダメでした。
89
-
90
- #試したこと2
91
- influxコマンドを実行すると、次のメッセージが出てしまいます。
92
- ```text
93
- Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
94
- Please check your connection settings and ensure 'influxd' is running.
95
- ```
96
- #試したこと3
97
- *pi@raspberrypi:~ $ curl http://localhost:8086*
98
- curl: (7) Failed to connect to localhost port 8086: 接続を拒否されました
99
- *pi@raspberrypi:~ $ ss -ltp*
100
- State Recv-Q Send-Q Local Address:Port Peer Address:Port
101
- LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:*
102
- LISTEN 0 5 127.0.0.1:ipp 0.0.0.0:*
103
- LISTEN 0 224 0.0.0.0:postgresql 0.0.0.0:*
104
- LISTEN 0 128 [::]:ssh [::]:*
105
- LISTEN 0 5 [::1]:ipp [::]:*
106
- LISTEN 0 4096 *:3000 *:*
107
- LISTEN 0 224 [::]:postgresql [::]:*
24
+ ```

1

質問を分かりやすく編集しました。

2021/11/18 00:23

投稿

raspypy
raspypy

スコア247

title CHANGED
@@ -1,1 +1,1 @@
1
- InfluxDBにアクセスできない
1
+ Raspberry Pi localhost:80 接続できない
body CHANGED
@@ -3,6 +3,10 @@
3
3
  **次の記事を参考にして、InfluxDBを作成しました。**
4
4
  https://www.mikan-tech.net/entry/raspi-sensortag-influxdb
5
5
 
6
+ 開発環境は、
7
+ ノートPC -(SSH接続)- Raspberry Pi
8
+ です。
9
+
6
10
  データベースの作成、Grafanaでの可視化までできていたのですが、
7
11
  Raspberry Piを再起動した後、次のエラーがでてしまい、データベースにアクセスできなくなってしまいました。
8
12
  原因が分からず困っております。
@@ -88,4 +92,16 @@
88
92
  ```text
89
93
  Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
90
94
  Please check your connection settings and ensure 'influxd' is running.
91
- ```
95
+ ```
96
+ #試したこと3
97
+ *pi@raspberrypi:~ $ curl http://localhost:8086*
98
+ curl: (7) Failed to connect to localhost port 8086: 接続を拒否されました
99
+ *pi@raspberrypi:~ $ ss -ltp*
100
+ State Recv-Q Send-Q Local Address:Port Peer Address:Port
101
+ LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:*
102
+ LISTEN 0 5 127.0.0.1:ipp 0.0.0.0:*
103
+ LISTEN 0 224 0.0.0.0:postgresql 0.0.0.0:*
104
+ LISTEN 0 128 [::]:ssh [::]:*
105
+ LISTEN 0 5 [::1]:ipp [::]:*
106
+ LISTEN 0 4096 *:3000 *:*
107
+ LISTEN 0 224 [::]:postgresql [::]:*