Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: default port changed to 8086 #151

Merged
merged 2 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
PIPENV_VENV_IN_PROJECT: true
ENABLED_CISO_8601: << parameters.enabled-ciso-8601 >>
- image: quay.io/influxdb/<< parameters.influxdb-image >>
environment:
INFLUXD_HTTP_BIND_ADDRESS: :8086
steps:
- prepare
- client-test:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 1.11.0 [unreleased]

### API
1. [#151](https://github.com/influxdata/influxdb-client-python/pull/151): Default port changed from 9999 -> 8086

## 1.10.0 [2020-08-14]

### Features
Expand Down
26 changes: 13 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Please follow the `Installation`_ and then run the following:

bucket = "my-bucket"

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down Expand Up @@ -178,7 +178,7 @@ The following options are supported:
.. code-block::

[influx2]
url=http://localhost:9999
url=http://localhost:8086
org=my-org
token=my-token
timeout=6000
Expand Down Expand Up @@ -270,7 +270,7 @@ The batching is configurable by ``write_options``\ :
from influxdb_client import InfluxDBClient, Point, WriteOptions
from influxdb_client.client.write_api import SYNCHRONOUS

_client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
_client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")
_write_client = _client.write_api(write_options=WriteOptions(batch_size=500,
flush_interval=10_000,
jitter_interval=2_000,
Expand Down Expand Up @@ -380,7 +380,7 @@ In a ini configuration file you are able to specify default tags by ``tags`` seg
.. code-block::

[influx2]
url=http://localhost:9999
url=http://localhost:8086
org=my-org
token=my-token
timeout=6000
Expand Down Expand Up @@ -415,7 +415,7 @@ Data are writes in an asynchronous HTTP request.
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import ASYNCHRONOUS

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")
write_api = client.write_api(write_options=ASYNCHRONOUS)

_point1 = Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
Expand All @@ -436,7 +436,7 @@ Data are writes in a synchronous HTTP request.
from influxdb_client import InfluxDBClient, Point
from influxdb_client .client.write_api import SYNCHRONOUS

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")
write_api = client.write_api(write_options=SYNCHRONOUS)

_point1 = Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
Expand All @@ -463,7 +463,7 @@ The API also support streaming ``FluxRecord`` via `query_stream <https://github.
from influxdb_client import InfluxDBClient, Point, Dialect
from influxdb_client.client.write_api import SYNCHRONOUS

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down Expand Up @@ -542,7 +542,7 @@ The ``client`` is able to retrieve data in `Pandas DataFrame <https://pandas.pyd
from influxdb_client import InfluxDBClient, Point, Dialect
from influxdb_client.client.write_api import SYNCHRONOUS

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down Expand Up @@ -654,7 +654,7 @@ If you would like to import gigabytes of data then use our multiprocessing examp
.from_iterable(DictReader(open('vix-daily.csv', 'r'))) \
.pipe(ops.map(lambda row: parse_row(row)))

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=True)
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=True)

"""
Create client that writes data in batches with 50_000 items.
Expand Down Expand Up @@ -763,7 +763,7 @@ Efficiency write data from IOT sensor
ops.distinct_until_changed(),
ops.map(lambda temperature: line_protocol(temperature)))

_db_client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=True)
_db_client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=True)

"""
Create client that writes data into InfluxDB
Expand Down Expand Up @@ -890,7 +890,7 @@ Gzip support

from influxdb_client import InfluxDBClient

_db_client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", enable_gzip=True)
_db_client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", enable_gzip=True)

.. marker-gzip-end

Expand Down Expand Up @@ -926,7 +926,7 @@ For more info about how configure HTTP retry see details in `urllib3 documentati
from influxdb_client import InfluxDBClient

retries = Retry(connect=5, read=2, redirect=5)
client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", retries=retries)
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", retries=retries)

Nanosecond precision
^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -956,7 +956,7 @@ that is replacement for python ``datetime.datetime`` object and also you should
"""
Prepare client.
"""
client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Both request header and body will be logged to standard output.

.. code-block:: python

_client = InfluxDBClient(url="http://localhost:9999", token="my-token", debug=True, org="my-org")
_client = InfluxDBClient(url="http://localhost:8086", token="my-token", debug=True, org="my-org")
2 changes: 1 addition & 1 deletion examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

bucket = "my-bucket"

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down
2 changes: 1 addition & 1 deletion examples/import_data_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def parse_row(row: OrderedDict):
.from_iterable(DictReader(open('vix-daily.csv', 'r'))) \
.pipe(ops.map(lambda row: parse_row(row)))

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=True)
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=True)

"""
Create client that writes data in batches with 50_000 items.
Expand Down
4 changes: 2 additions & 2 deletions examples/import_data_set_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class InfluxDBWriter(multiprocessing.Process):
def __init__(self, queue):
multiprocessing.Process.__init__(self)
self.queue = queue
self.client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=False)
self.client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=False)
self.write_api = self.client.write_api(
write_options=WriteOptions(write_type=WriteType.batching, batch_size=50_000, flush_interval=10_000))

Expand Down Expand Up @@ -199,7 +199,7 @@ def init_counter(counter, progress, queue):
'|> rename(columns: {_time: "pickup_datetime"})' \
'|> drop(columns: ["_start", "_stop"])|> limit(n:10, offset: 0)'

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=False)
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=False)
result = client.query_api().query(query=query)

"""
Expand Down
2 changes: 1 addition & 1 deletion examples/ingest_dataframe_default_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
df = pd.read_csv("vix-daily.csv")
print(df.head())

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

"""
Ingest DataFrame with default tags
Expand Down
2 changes: 1 addition & 1 deletion examples/iot_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def line_protocol(temperature):
ops.distinct_until_changed(),
ops.map(lambda temperature: line_protocol(temperature)))

_db_client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=True)
_db_client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=True)

"""
Create client that writes data into InfluxDB
Expand Down
2 changes: 1 addition & 1 deletion examples/nanosecond_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""
Prepare client.
"""
client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down
2 changes: 1 addition & 1 deletion examples/query.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from influxdb_client import InfluxDBClient, Point, Dialect
from influxdb_client.client.write_api import SYNCHRONOUS

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down
2 changes: 1 addition & 1 deletion examples/query_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")

write_api = client.write_api(write_options=SYNCHRONOUS)
query_api = client.query_api()
Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/client/influxdb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, url, token, debug=None, timeout=10000, enable_gzip=False, org
"""
Initialize defaults.

:param url: InfluxDB server API url (ex. http://localhost:9999).
:param url: InfluxDB server API url (ex. http://localhost:8086).
:param token: auth token
:param debug: enable verbose logging of http requests
:param timeout: default http client timeout
Expand Down Expand Up @@ -118,7 +118,7 @@ def from_env_properties(cls, debug=None, enable_gzip=False):
- INFLUXDB_V2_TIMEOUT
- INFLUXDB_V2_VERIFY_SSL
"""
url = os.getenv('INFLUXDB_V2_URL', "http://localhost:9999")
url = os.getenv('INFLUXDB_V2_URL', "http://localhost:8086")
token = os.getenv('INFLUXDB_V2_TOKEN', "my-token")
timeout = os.getenv('INFLUXDB_V2_TIMEOUT', "10000")
org = os.getenv('INFLUXDB_V2_ORG', "my-org")
Expand Down
2 changes: 1 addition & 1 deletion notebooks/realtime-stream.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"metadata": {},
"outputs": [],
"source": [
"client = InfluxDBClient(url='http://localhost:9999', token='my-token', org='my-org')"
"client = InfluxDBClient(url='http://localhost:8086', token='my-token', org='my-org')"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/stock-predictions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"#prices_dataset = pd.read_csv('./prices-split-adjusted.csv', header=0)\n",
"\n",
"# read prices from InfluxDB 2.0 \n",
"client = InfluxDBClient(url=\"http://localhost:9999\", token=\"my-token\", org=\"my-org\", debug=False)\n",
"client = InfluxDBClient(url=\"http://localhost:8086\", token=\"my-token\", org=\"my-org\", debug=False)\n",
"query='''\n",
"from(bucket:\"my-bucket\")\n",
" |> range(start: 0, stop: now())\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/stock_predictions_import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main():
.from_iterable(DictReader(response.iter_lines(decode_unicode=True))) \
.pipe(ops.map(lambda row: parse_row(row)))

client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=False)
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=False)
write_api = client.write_api(write_options=WriteOptions(batch_size=50_000, flush_interval=10_000))

write_api.write(bucket="my-bucket", record=data)
Expand Down
2 changes: 1 addition & 1 deletion notebooks/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
urls = ["http://localhost:9999/"]
urls = ["http://localhost:8086/"]

## Token for authentication.
token = "my-token"
Expand Down
4 changes: 2 additions & 2 deletions scripts/influxdb-onboarding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
set -e

echo "Wait to start InfluxDB 2.0"
wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics
wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:8086/metrics

echo
echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
echo
curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
curl -i -X POST http://localhost:8086/api/v2/setup -H 'accept: application/json' \
-d '{
"username": "my-user",
"password": "my-password",
Expand Down
5 changes: 3 additions & 2 deletions scripts/influxdb-restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ echo
docker pull ${INFLUXDB_V2_IMAGE} || true
docker run \
--detach \
--env INFLUXD_HTTP_BIND_ADDRESS=:8086 \
--name influxdb_v2 \
--network influx_network \
--publish 9999:9999 \
--publish 8086:8086 \
${INFLUXDB_V2_IMAGE}

echo "Wait to start InfluxDB 2.0"
wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics
wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:8086/metrics

#
# Post onBoarding request to InfluxDB 2
Expand Down
2 changes: 1 addition & 1 deletion tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BaseTest(unittest.TestCase):
def setUp(self) -> None:
self.conf = influxdb_client.configuration.Configuration()

self.host = os.getenv('INFLUXDB_V2_URL', "http://localhost:9999")
self.host = os.getenv('INFLUXDB_V2_URL', "http://localhost:8086")
self.debug = False
self.auth_token = os.getenv('INFLUXDB_V2_TOKEN', "my-token")
self.org = os.getenv('INFLUXDB_V2_ORG', "my-org")
Expand Down
2 changes: 1 addition & 1 deletion tests/config-disabled-ssl.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[influx2]
url=http://localhost:9999
url=http://localhost:8086
org=my-org
token=my-token
timeout=6000
Expand Down
2 changes: 1 addition & 1 deletion tests/config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[influx2]
url=http://localhost:9999
url=http://localhost:8086
org=my-org
token=my-token
timeout=6000
Expand Down
8 changes: 4 additions & 4 deletions tests/test_InfluxDBClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def tearDown(self) -> None:
self.httpd_thread.join()

def test_TrailingSlashInUrl(self):
self.client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
self.assertEqual('http://localhost:9999', self.client.api_client.configuration.host)
self.client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")
self.assertEqual('http://localhost:8086', self.client.api_client.configuration.host)

self.client = InfluxDBClient(url="http://localhost:9999/", token="my-token", org="my-org")
self.assertEqual('http://localhost:9999', self.client.api_client.configuration.host)
self.client = InfluxDBClient(url="http://localhost:8086/", token="my-token", org="my-org")
self.assertEqual('http://localhost:8086', self.client.api_client.configuration.host)

def test_ConnectToSelfSignedServer(self):
import http.server
Expand Down
2 changes: 1 addition & 1 deletion tests/test_QueryApiDataFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _create_point(index) -> Point:
self.assertGreater(len(result), 1)

def test_query_without_credentials(self):
_client = InfluxDBClient(url="http://localhost:9999", token="my-token-wrong-credentials", org="my-org")
_client = InfluxDBClient(url="http://localhost:8086", token="my-token-wrong-credentials", org="my-org")

with self.assertRaises(ApiException) as ae:
query = 'from(bucket: "my-bucket")' \
Expand Down
6 changes: 3 additions & 3 deletions tests/test_WriteApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def test_write_list_of_list_point_with_default_tags(self):
self.assertEqual("LA", record[self.data_center_key])

def test_check_write_permission_by_empty_data(self):
client = InfluxDBClient(url="http://localhost:9999", token="my-token-wrong", org="my-org")
client = InfluxDBClient(url="http://localhost:8086", token="my-token-wrong", org="my-org")
write_api = client.write_api(write_options=SYNCHRONOUS)

with self.assertRaises(ApiException) as cm:
Expand Down Expand Up @@ -739,14 +739,14 @@ def test_connection_option_from_conf_file(self):
self.client.close()
self.client = InfluxDBClient.from_config_file(self._path_to_config(), self.debug)

self.assertEqual("http://localhost:9999", self.client.url)
self.assertEqual("http://localhost:8086", self.client.url)
self._check_connection_settings()

def test_connection_option_from_env(self):
self.client.close()
self.client = InfluxDBClient.from_env_properties(self.debug)

self.assertEqual("http://localhost:9999", self.client.url)
self.assertEqual("http://localhost:8086", self.client.url)
self._check_connection_settings()

def _check_connection_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_WriteApiDataFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DataFrameWriteTest(BaseTest):

def setUp(self) -> None:
super().setUp()
self.influxDb_client = InfluxDBClient(url="http://localhost:9999", token="my-token", debug=False)
self.influxDb_client = InfluxDBClient(url="http://localhost:8086", token="my-token", debug=False)

self.write_options = WriteOptions(batch_size=10_000, flush_interval=5_000, retry_interval=3_000)
self._write_client = WriteApi(influxdb_client=self.influxDb_client, write_options=self.write_options)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_WriteApiPickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class InfluxDBWriterToPickle:

def __init__(self):
self.client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org", debug=False)
self.client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org", debug=False)
self.write_api = self.client.write_api(
write_options=WriteOptions(write_type=WriteType.batching, batch_size=50_000, flush_interval=10_000))

Expand Down
Loading