質問編集履歴

2

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

2021/11/18 00:24

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -2,17 +2,9 @@
2
2
 
3
3
 
4
4
 
5
- **次の記事を参考にして、InfluxDBを作成しました。**
5
+ **次の記事を参考にして、DBを作成しました。**
6
6
 
7
7
  https://www.mikan-tech.net/entry/raspi-sensortag-influxdb
8
-
9
-
10
-
11
- 開発環境は、
12
-
13
- ノートPC -(SSH接続)- Raspberry Pi
14
-
15
- です。
16
8
 
17
9
 
18
10
 
@@ -29,74 +21,6 @@
29
21
  次のメッセージはプログラムを実行したときのエラーです。
30
22
 
31
23
  ```text
32
-
33
- Traceback (most recent call last):
34
-
35
- File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
36
-
37
- (self._dns_host, self.port), self.timeout, **extra_kw)
38
-
39
- File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 80, in create_connection
40
-
41
- raise err
42
-
43
- File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 70, in create_connection
44
-
45
- sock.connect(sa)
46
-
47
- ConnectionRefusedError: [Errno 111] Connection refused
48
-
49
-
50
-
51
- During handling of the above exception, another exception occurred:
52
-
53
-
54
-
55
- Traceback (most recent call last):
56
-
57
- File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
58
-
59
- chunked=chunked)
60
-
61
- File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
62
-
63
- conn.request(method, url, **httplib_request_kw)
64
-
65
- File "/usr/lib/python3.7/http/client.py", line 1260, in request
66
-
67
- self._send_request(method, url, body, headers, encode_chunked)
68
-
69
- File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
70
-
71
- self.endheaders(body, encode_chunked=encode_chunked)
72
-
73
- File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
74
-
75
- self._send_output(message_body, encode_chunked=encode_chunked)
76
-
77
- File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
78
-
79
- self.send(msg)
80
-
81
- File "/usr/lib/python3.7/http/client.py", line 970, in send
82
-
83
- self.connect()
84
-
85
- File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in connect
86
-
87
- conn = self._new_conn()
88
-
89
- File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
90
-
91
- self, "Failed to establish a new connection: %s" % e)
92
-
93
- urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x72d8b310>: Failed to establish a new connection: [Errno 111] Connection refused
94
-
95
-
96
-
97
- During handling of the above exception, another exception occurred:
98
-
99
-
100
24
 
101
25
  Traceback (most recent call last):
102
26
 
@@ -120,94 +44,4 @@
120
44
 
121
45
 
122
46
 
123
- Traceback (most recent call last):
124
-
125
- File "./56_InfluxDB.py", line 45, in <module>
126
-
127
- write_to_influxdb(sdata)
128
-
129
- File "./56_InfluxDB.py", line 25, in write_to_influxdb
130
-
131
- db.write_points(points)
132
-
133
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 608, in write_points
134
-
135
- consistency=consistency)
136
-
137
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 685, in _write_points
138
-
139
- protocol=protocol
140
-
141
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 419, in write
142
-
143
- headers=headers
144
-
145
- File "/home/pi/.local/lib/python3.7/site-packages/influxdb/client.py", line 342, in request
146
-
147
- timeout=self._timeout
148
-
149
- File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
150
-
151
- resp = self.send(prep, **send_kwargs)
152
-
153
- File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
154
-
155
- r = adapter.send(request, **kwargs)
156
-
157
- File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
158
-
159
- raise ConnectionError(e, request=request)
160
-
161
- 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'))
162
-
163
47
  ```
164
-
165
-
166
-
167
- ##試したこと1
168
-
169
- **sudo nano /etc/influxdb/influxdb.conf**
170
-
171
- にて、
172
-
173
- bind-address = "127.0.0.1:8086"
174
-
175
- を追加しましたが、ダメでした。
176
-
177
-
178
-
179
- #試したこと2
180
-
181
- influxコマンドを実行すると、次のメッセージが出てしまいます。
182
-
183
- ```text
184
-
185
- Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
186
-
187
- Please check your connection settings and ensure 'influxd' is running.
188
-
189
- ```
190
-
191
- #試したこと3
192
-
193
- *pi@raspberrypi:~ $ curl http://localhost:8086*
194
-
195
- curl: (7) Failed to connect to localhost port 8086: 接続を拒否されました
196
-
197
- *pi@raspberrypi:~ $ ss -ltp*
198
-
199
- State Recv-Q Send-Q Local Address:Port Peer Address:Port
200
-
201
- LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:*
202
-
203
- LISTEN 0 5 127.0.0.1:ipp 0.0.0.0:*
204
-
205
- LISTEN 0 224 0.0.0.0:postgresql 0.0.0.0:*
206
-
207
- LISTEN 0 128 [::]:ssh [::]:*
208
-
209
- LISTEN 0 5 [::1]:ipp [::]:*
210
-
211
- LISTEN 0 4096 *:3000 *:*
212
-
213
- LISTEN 0 224 [::]:postgresql [::]:*

1

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

2021/11/18 00:23

投稿

raspypy
raspypy

スコア247

test CHANGED
@@ -1 +1 @@
1
- InfluxDBにアクセスできない
1
+ Raspberry Pi localhost:80 接続できない
test CHANGED
@@ -8,6 +8,14 @@
8
8
 
9
9
 
10
10
 
11
+ 開発環境は、
12
+
13
+ ノートPC -(SSH接続)- Raspberry Pi
14
+
15
+ です。
16
+
17
+
18
+
11
19
  データベースの作成、Grafanaでの可視化までできていたのですが、
12
20
 
13
21
  Raspberry Piを再起動した後、次のエラーがでてしまい、データベースにアクセスできなくなってしまいました。
@@ -179,3 +187,27 @@
179
187
  Please check your connection settings and ensure 'influxd' is running.
180
188
 
181
189
  ```
190
+
191
+ #試したこと3
192
+
193
+ *pi@raspberrypi:~ $ curl http://localhost:8086*
194
+
195
+ curl: (7) Failed to connect to localhost port 8086: 接続を拒否されました
196
+
197
+ *pi@raspberrypi:~ $ ss -ltp*
198
+
199
+ State Recv-Q Send-Q Local Address:Port Peer Address:Port
200
+
201
+ LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:*
202
+
203
+ LISTEN 0 5 127.0.0.1:ipp 0.0.0.0:*
204
+
205
+ LISTEN 0 224 0.0.0.0:postgresql 0.0.0.0:*
206
+
207
+ LISTEN 0 128 [::]:ssh [::]:*
208
+
209
+ LISTEN 0 5 [::1]:ipp [::]:*
210
+
211
+ LISTEN 0 4096 *:3000 *:*
212
+
213
+ LISTEN 0 224 [::]:postgresql [::]:*